camaya
camaya

Reputation: 377

Same project in multiple sites with different configuration

I want to deploy same web application to multiple sites with different domains and different web ui and database.

In my ServiceDefinition i have this:

<Sites>
  <Site name="Web">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" />
    </Bindings>
  </Site>
  <Site name="Web2" physicalDirectory="..\WebRole1">
    <Bindings>
      <Binding name="Endpoint1" endpointName="Endpoint1" />
    </Bindings>
  </Site>
</Sites>

How can I load different css/images/js and database for each site?

Upvotes: 0

Views: 222

Answers (1)

AvkashChauhan
AvkashChauhan

Reputation: 20571

Based on the information you provided you could be asking two very different things.

The Service Definition you provided you are actually creating two separate websites and they may have nothing in common and they are launched from two separate folders. When you use multiple sites in Service Definition, your objective is to have multiple different sites which may or may not share any code in between. And based on the hostheader you can decide which physical folder content will be displayed. Here is a great example on how to use multiple websites with Windows Azure Web Role.

As you have also mentioned that you want to load different css/images/js, it is possible that you just want one single website however your have different resources depend on different header. This can be done very easily in one single website by parsing the hostheader in URL during page load event (or globally), and then create a based path, redirecting to a specific resources folder which contains all of your static resources. And when you deploy your website, you can include all the static resources in different folders with identical file structure. You might not need multiple websites for such objective.

Upvotes: 1

Related Questions