Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

c# - Can you deploy multiple webapps on one Windows Azure instance?

It is possible have a bunch of web apps running in one windows azure small compute instance?

I am looking at using Azure as a place to sit a bunch of projects (web apps) that are in dev and non-production ready. Some are actually moth-balled, but I'd like to have an active instance of them somewhere. I don't want to pay for separate compute hours for each app, that is just sitting there 90 % of the time.

The other option I am considering to get a shared hosting account for these projects.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes, it is now possible with the latest Azure platform updates that were released late 2010.

You have to make the appropriate config changes in your Azure Project's service definition file. Below is an example of multiple sites on the same domain. The Register site is using an https endpoint (you must also configure your cert) and the rest are using http. The Public site does not specify a host header and will catch anything not explicity specified. This is great when you have one app that needs to handle multiple subdomains (like shopify). In order to make this work you need to have a dns that allows wildcard cnames (GoDaddy dns does not). Obviously, you also need a cname record that points to azure for each of the other subdomains. One other thing to note in this example is that the physicalDirectory for the apps are relative to the Azure Project. Hope this helps!

Here's a link that may help: http://msdn.microsoft.com/en-us/library/gg433110.aspx

    <?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SampleAzureProject" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="RegisterSite_WebRole">
    <Sites>
      <Site name="RegisterSite" physicalDirectory="..RegisterSite">
        <Bindings>
          <Binding name="RegisterBinding" endpointName="Endpoint1" hostHeader="register.sample.com" />
        </Bindings>
      </Site>
      <Site name="PublicSite" physicalDirectory="..PublicSite">
        <Bindings>
          <Binding name="PublicBinding" endpointName="Endpoint2" hostHeader="" />
        </Bindings>
      </Site>
      <Site name="ManageSite" physicalDirectory="..ManageSite">
        <Bindings>
          <Binding name="ManageBinding" endpointName="Endpoint2" hostHeader="manage.sample.com" />
        </Bindings>
      </Site>
      <Site name="MarketingSite" physicalDirectory="..MarketingSite">
        <Bindings>
          <Binding name="MarketingBinding" endpointName="Endpoint2"  hostHeader="www.sample.com" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="https" port="443" certificate="SampleReg" />
      <InputEndpoint name="Endpoint2" protocol="http" port="80" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
    </Imports>
    <Certificates>
      <Certificate name="SampleReg" storeLocation="LocalMachine" storeName="My" />
    </Certificates>
  </WebRole>
</ServiceDefinition>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...