Question

Goal:This is all about paying for one WebRole instance but demoing/testing multiple sites what are completely independent VS projects (ASP MVC 5, but this must not matter). Sites are differentiated not by port number instead domain (host) name)

Maybe I want too much, but this can be easily done using IIS by configuring IIS sites by host name (or IP, or port).

I understand (and can accept) that restriction, that these different VS projects must exist together in a VS solution, and can not deployed independently, I suppose a common Azure project exist which contains all configuration metainfo.

Tools: VS 2013 (Premium) and Azure tools 2.2

Now I have a solution with 2 projects in it: MySite (an ASP MVC 5 project) MySite.Azure

I would like to add a 2nd MVC project, and would like to modify config and other files in MySite.Azure to deploy both MySite and MySite2 and I would like to assign different hostname s to MySite and MySite2. (I do know how to assign my hostnames to my Azure IP using my DNS provider, please suppose that's already done)


If differentiating by host name is not possible, still is it possible to differentiate by port number?

Était-ce utile?

La solution

Just to start from the top

You don't need all projects in a single solution but it does make it easier, so I will assume you will at this stage.

Add in your second project to your solution.

On your Azure project (MySite.Azure), on the Roles folder, Right Click and press Add > Web Role Project In Solution and add in the other project to your Azure project.

Next in your ServiceDefinition.csdef in the section

<Site>
   <Site name="Site1" physicalDirectory="C:\Users\User\Documents\Visual Studio 2012\Projects\Project1">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="domain1.com" />
      <Binding name="Endpoint2" endpointName="Endpoint2" hostHeader="domain1.com" />
    </Bindings>
  </Site>
  <Site name="Site2" physicalDirectory="C:\Users\User\Documents\Visual Studio 2012\Projects\Project2">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="domain2.com" />
      <Binding name="Endpoint2" endpointName="Endpoint2" hostHeader="domain2.com" />
    </Bindings>
  </Site>
</Sites>
<Endpoints>
  <InputEndpoint name="Endpoint1" protocol="http" port="80" />
  <InputEndpoint name="Endpoint2" protocol="https" port="443" certificate="SSLName" />
</Endpoints>

This shows 2 endpoints as well for SSL usage.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top