Skip to content

Hosting The Same Windows Azure Web Project With Two Different Configurations

Updated: at 05:05 PM

The Problem

In my scenario, I have the same web project that I want to host in two different Windows Azure Data Centers (BTW, Steve Marx let me know it’s “Windows Azure” and not “Azure” at MVP Summit so I’ll try and keep my terminology right as much as I can).  Each Windows Azure Data Center has it’s own azure account (Azure Credential).  It resolves to a different domain name and as part of that scenario, has different properties in the ServiceConfiguration.csfg file.

 

 

What Happens By Default

When you create a new Azure WebRole, the wizard automatically creates a web project for you.  In my case, that is fine for the first datacenter deployment, but what about the second?  In this post (hopefully, as I’m blogging as I’m doing it), I will show you how to create multiple deployments of the same web project.  Below is a screen shot of what my project looks like out of the box.

image

 

Adding Another Web Role Pointing At Same Web Project

So, here we go.

First, add a new cloud project / web role as follows:

image

 

Add the project:

image

Add the Web Role

image

Now, associate this role with the original web project “Web” and notice that a new web site has been created by the previous step. Our plan will be to delete the one that just go created.

image

That seems to have worked, so now let’s remove the WebRole1 project and then delete it from the directory.

image

Now, I believe we have what we want as shown below.

image

The final thing I need to do is simply update my ServiceConfiguration and ServiceDefinition files with what I want that is specific to AzureWebRoleConnectionRoadCom.

My plan is to do this for all my different deployments of the same project.  If things don’t continue to go swimmingly, I’ll add some notes to this post to indicate that maybe this wasn’t the best possible plan, but for now, I’m keeping my fingers crossed that this will work.