Posts Tagged web role

Migrating Web Applications to Windows Azure

With the release of Windows Azure only a few weeks away, it is likely that more and more developers are going to want to move their existing Web applications into the cloud. Fortunately, Microsoft has made it very easy to do so and a big part of that is the decision to make Azure Web Roles look (and behave) so much like ASP.NET Web Applications.

Really, a Web Role project and a Web Application project are identical, with one very minor exception: by default, Web Role projects contain a reference to the Microsoft.ServiceHosting.ServiceRuntime assembly and Web Application projects do not:

The ONLY difference between a Web Role project and a Web Application project

The ONLY difference between a Web Role project and a Web Application project

Because Web Roles and Web Applications are architecturally identical, you can easily add an existing Web application to a Windows Azure application… It’s a two step process; first, add the Web Application project to your cloud solution:

Adding a new Web Application project to an existing Cloud Service

Adding a new Web Application project to an existing Cloud Service

Second, add the project as a Web Role by right-clicking “Roles” in Solution Explorer and selecting Add > Web Role Project in solution…

Adding an existing Web Role project in solutions

Adding an existing Web Role project in solutions

Your original Web Application project is now part of your Windows Azure application! To make it identical to a Web Role created “from scratch,” simply add a reference to Microsoft.ServiceHosting.ServiceRuntime, which you can find in the Windows Azure SDK (the default location in most cases will be C:\Program Files\Windows Azure SDK\v1.0\ref\Microsoft.ServiceHosting.ServiceRuntime.dll.)

One more thing – when you add an existing application to a Visual Studio solution, it just creates a pointer to the original .csproj/.vbproj file from your solution – in other words, make sure you create a backup copy of your original Web Application before you move it into the cloud!

That’s the easy part of migration – however, it can get more complicated and more challenging if your application relies on data storage, services, client-side code or 3rd party libraries. I’ll be posting some short articles on how to deal with these various scenarios in the coming days and weeks.

, ,

7 Comments