Hosting The Same Windows Azure Web Project With Two Different Configurations

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.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. Thanks BKR, good to know. It is a hassle deleting that extra project and I already have forgotten to do it a couple times.

  2. Peter,
    I just did this on Friday. IIRC, you can skip the “Add a Web Role” step. You just don’t create a role, and click the “OK” button, creating the new Cloud Project with no roles in it at all. That saves you deleting the dummy project later. But you end up in the same place either way.

    BKR

Trackbacks

  1. Hosting The Same Windows Azure Web Project With Two Different Configurations – Peter Kellner…

    Thank you for submitting this cool story – Trackback from DotNetShoutout…

Your Comments

*

Protected with IP Blacklist CloudIP Blacklist Cloud

Follow

Get every new post delivered to your Inbox

Join other followers: