Azure Series Part 1 : Migrating your Existing Site to a Windows Azure Web Role

by Arra Derderian 24. January 2011 00:32

With the emergence of Windows Azure, Cloud Construct has decided to migrate its existing site to a web role to run in the Azure cloud. We will be utilizing a hosted service, App Storage, and SQL Azure. Our existing site runs as a .NET 4.0 just-in-time compiled website, hosted on IIS, and with a SQL backend. This post will deal with migrating the existing .NET 4.0 site to run in the Azure service host environment, following posts will deal with connecting to SQL Azure.

  • Step 1 : Create a new cloud service project.

  • Step 2 : Assign a web role project to the Cloud Service solution.

You will notice that a new Windows Azure Cloud Service project will be added to your new solution. Secondly. a Web Role project will be added which is similar to a web application project but includes a WebRole.cs file which defines the web role entry point. This WebRole application will be assigned to your cloud service project and will be started up when your service starts up. The WebRole project will be included with some default files such as a Scripts directory and some basic .NET web pages. I deleted all of these boilerplate resources so  could begin porting my site into this project.

  • Step 3 : Port over your existing site content.

Right now the easiest way to migrate your site into the project is to simply copy all the files over. Do not overwrite the web.config file! Any settings you had in there prior you can then cut-n-paste them into the WebRole project web.config. After you have copied all your files over, there are a few steps you will have to perform. If you are coming from a web application project then you will not have to perform these next step two steps.

  • Step 3a : Convert all website files to web application files.

Because the WebRole project is technically a web application project you must convert your just-in-time compiled web pages to web application pages. This basically means adding a *designer.cs file to every page. The easiest way to do this is right click on the project in solution explorer and choose "Convert to Web Application". This will add designer files to all web page files.
  • Step 3b : Migrate your App_Code directory to a class library

Because a web application project does not include an App_Code directory you must move all class files to a separate class library project. You will end up with multiple assembly conflicts if you do not which will cause a whole bunch of other problems.
  • Step 4 : Rebuild and start your new cloud service.

Now that you have all your content ported over you can rebuild your new solution and make sure everything is all good. Lastly, start debugging the project and make sure your website runs in the local dev environment. If it all comes up the first time then your in luck. You might have to tweak some other portions of your site to make sure it all works but for the most part this should get you there. One snag I hit was documents being served out of the site like PDF's will require you to set their build action to "Content" instead of "None". This will make sure the file gets packaged and deployed with your cloud service.

Tags:

ASP.NET | Cloud Computing | Engineering | Technology

Comments

11/7/2011 1:13:40 PM #

visite Marrakech

I equal this website its a chief calm ! Cheerful I detected this on google. “Observe your enemies, for they principal discovery absent your failings.” by Antisthenes.

visite Marrakech France | Reply

11/13/2011 12:48:55 PM #

Marrakech

Decorous compose-up, I’m standard company of unit’s place, contend up the pleasant run, plus It is going to be a methodical tourist for a yearn rhythm. “Saintly folly is saintly realize in belie.” by Jest Billings.

Marrakech France | Reply

11/16/2011 7:44:52 AM #

vente immobilier maroc

Nice scratch-up, I’m conventional visitor of alone’s spot, assert up the pretty drive, and It is going to be a steady visitor for a ache tour. “Nice balderdash is propitious intuition in masquerade.” by Spoof Billings.

vente immobilier maroc France | Reply

11/17/2011 1:19:18 PM #

Lexia3

and [in early September] I made it clear that I would be ecstatic to be a part of All My Children in a prominent way if they

Lexia3 Greece | Reply

11/30/2011 1:41:29 PM #

citibank online banking

Been checking in every couple hours to see, but that dude still hasn't sold any snowballs yet.

citibank online banking United States | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

Click to change captcha
biuquote
  • Comment
  • Preview
Loading