Convert your ASP.Net app to Windows Azure

Introduction 

If you are excited about Windows Azure platform and wanted to see how your web application behaves in new cloud environment, this article is for you to follow step by step process to convert your app and move to cloud environment.    

Prerequisite

You will need to have an account with windows azure to host the app. You may also try the 30 day free pass as described in my previous article. A list of required software is also available here to work with Windows Azure development.

Steps

I have created a sample website - MySite - to start with the demo. Below are the steps to deploy the same to Windows Azure environment.

Step1. Open the solution in VS 2010.


Step 2. Now we need to add a new windows azure project to the existing solution. So, right click on the solution add a new project.

Step 3. Choose "Cloud" from the installed templates and select Windows Azure Project. Type in a name - MyAzureSite.

Step 4. You will be prompted to add a Role to the project. Since we are going to add and existing web application as a web role, we do not need to add a role here. Click OK with out selecting any role. 

Step 5. Right click on the Roles folder of the new Azure project and choose Add --> Web Role Project in solution.

Step 6. Choose the existing project "MySite" and click OK.

Step 7. Now you have added the existing web application as a Web Role to the windows azure project. So when you publish this windows azure project, the output package will contain all required libraries to deploy "MySite" web application to Azure Platform.

Step 8. Now you can build the solution and make sure that there are no errors. Then Right click on the MyAzureSite and choose "publish".

Step 9. Choose first option as shown below. You may also go with the second option, but you will need to add certificates etc and directly deploy to the cloud in that way.

Step 10. Once the package is ready, VS will open the location in windows explorer. You will two files in the output folder. One is the package file which contains the code for deployment. The other one is the configuration file where you will see the service configuration details of Azure package.




Part 1 of the process is complete now, with which you were able to create a deployment package for the web application and a service configuration file. Now, you will use these two files and deploy the application in cloud environment. Follow the remaining steps to complete the process.

Step 11. Sign in to window.azure.com with your account ID. 


Step 12. If your Windows Azure account is setup and enabled, you will see following screen. Click on "Hosted Services, Storage Accounts & CDN" tab on the left side bar.


Step 13. Select "Hosted Services" on the left side panel.

Step 14. Now you want to add a new hosted service to host the web application. By hosting a service, you are trying to deploy a service or a website to a public accessible place. In this case the public accessible place is Azure cloud infrastructure.
Choose "New Hosted Service" from the top left corner.

Step 15. You will be prompted with following screen. Fill in the details as shown in the screen. Finally you will need to browse the package and configuration file created as per the "Part 1' of the steps described from steps 1 through 10.

Step 16. Browse the package file and configuration file.

Step 17. You will notice a warning when you click Ok in above step. This is because the recommended minimum number of instance for an azure role is 2. In our app, it is set as 1 by default. You can ignore this for now and click "Yes"

Step 18. The deployment process will take some time. When it is ready, you get following screen. Few things worth noticing; one, note the environment column as "staging" because you choose to create a new hosted environment and it goes to staging first. Also note a temp DNS name, this can be used to test the application on staging environment. For example, in this case, you can click on the DNS name link and type in start page of the application - http://######someguid####.cloudapp.net/yourtestpage.aspx.

Step 19. You can browse and test the application here on staging before moving to production environment.
Step 20. Once you verify the app in staging, you can decide to promote it to production by clicking "Swap VIP" button on top. This will simply create a new DNS with prefix the service name given while creating the host.

Step 21. Click OK.

Step 22. You get the following screen. Few things worth noticing here, the environment is changed to 'production' and the new DNS name. Now you may access the application with new DNS.

Step 23. Access the application with new DNS as follows. 

You are now ready to scale your application on-demand with windows azure platform!

References:

  1. http://www.microsoft.com/en-us/cloud/developer/resource.aspx?resourceId=what-is-windows-azure&fbid=DzEuhS2JkYT
  2. http://www.microsoft.com/en-us/cloud/developer/resource.aspx?resourceId=introducing-windows-azure&fbid=DzEuhS2JkYT

Note: 

Comments

Popular posts from this blog

SCTE35 Parser

Dijkstra's Algorithm in JavaScript