Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I need a walkthrough or steps of how to deploy ASP.NET Website on Windows Azure

Tags:

asp.net

azure

I need a walkthrough or steps of how to deploy ASP.NET Website on Windows Azure.

like image 221
Manoj Talreja Avatar asked Feb 20 '10 19:02

Manoj Talreja


2 Answers

Here are the steps to deploy ASP.NET Website on Windows Azure.

Assumptions --> 1. You have already created an ASP.Net website.

Step 1: Install following things on your machine

  1. Windows Azure SDK(http://www.microsoft.com/downloads/details.aspx?FamilyID=aa40f3e2-afc5-484d-b4e9-6a5227e73590&displaylang=en )

  2. Windows Azure Tools for Visual Studio 2008/2010(http://www.microsoft.com/downloads/details.aspx?familyid=5664019E-6860-4C33-9843-4EB40B297AB6&displaylang=en )

-----------------------------------------------------------------------------------------

Step 2: Open Visual Studio and say New>Project and then select project type cloud from Visual C# and select Windows Azure Cloud Service template. alt text

Give name to your project. Select Location for the same and Click on OK button

-----------------------------------------------------------------------------------------

Step 3: In New Cloud Service Project window select ASP.Net Web role and click on [>] button and say OK

alt text

-----------------------------------------------------------------------------------------

Step 4: Solution explorer will look like this-->

alt text

-----------------------------------------------------------------------------------------

Step 5: Right click on WebRole1 project from solution explorer and Click on Remove

alt text

-----------------------------------------------------------------------------------------

Step 5: After removing WebRole1 project from solution explorer

alt text

-----------------------------------------------------------------------------------------

Step 6: Now right click on Solution explorer and say Add>Existing Project and add your existing ASP.Net application to solution exlorer.

alt text

-----------------------------------------------------------------------------------------

Step 7: After adding your existing ASP.Net application to solution exlorer.

alt text

-----------------------------------------------------------------------------------------

Step 8: Right Click on CloudService1>Roles>No Project associated(WebRole1) and then say Associate With>Web Role project in solution

alt text

-----------------------------------------------------------------------------------------

Step 9: Select your existing ASP.Net Web Application in solution explorer and say OK

alt text

-----------------------------------------------------------------------------------------

Step 10: Now Hit F5 to run your cloud service.

And see the task bar. You will notice--> alt text

And now your ASP.Net web application will run on local Developement Fabric. Your ASP.Net cloud service is still NOT ready for deploying on Windows Azure.

alt text

-----------------------------------------------------------------------------------------

Step 11: Now if you are using Third party DLLs in your ASP.Net Web Application then create a folder named Shared under solution explorer. And add all the 3rd party DLLs in that.

-----------------------------------------------------------------------------------------

Step 12: Now go to myExistingASP.NetwebSite>References> and add the 3rd party references from Shared folder created in step 11. Now select all the references added just now and set their 'Copy Local' property to true

-----------------------------------------------------------------------------------------

Step 13: If your are using session state in your ASP.Net web app then you need to use AspProvider for session state management.The Windows Azure SDK which you have installed contains a sample with session provider implementation (its having same functionality as the corresponding SQL provider. Please see the AspProvider sample and the AspProviderDemo for an example of how to use it.)

-----------------------------------------------------------------------------------------

Step 14: Make sure you catch every exception during initialization of web application and log it properly.

-----------------------------------------------------------------------------------------

Step 15: If you are using Certificate in your ASP.Net application then for your certificate to work in the cloud it needs to have exportable private key. Certificates without exportable private key are not supported. If you use Windows Certificates Manager you need to make sure to select “Yes, export the private key” option while exporting the certificate.

-----------------------------------------------------------------------------------------

Step 16: Make sure that your web.config or app.config does not contain malformed xml.

-----------------------------------------------------------------------------------------

Step 17: Now your application is ready for deploying it on Windows Azure.

-----------------------------------------------------------------------------------------

Step 18: Now go to Solution Explorer and right-click the cloud project(CloudService1) and say Publish.

alt text

-----------------------------------------------------------------------------------------

Step 19: The publish folder for your application will open in Windows Explorer, showing a package file and a config file.

alt text

-----------------------------------------------------------------------------------------

Step 20: Now what you need is Windows Azure Account. So get an Azure Account and log into that. Either create a new project on the portal or select an existing one. Then you will see Production environment on left side and Staging environment on right side.

alt text

-----------------------------------------------------------------------------------------

Step 21: Now Click on the Deploy button under Stagging. Now will be able to see following form.

alt text

-----------------------------------------------------------------------------------------

Step 22: Browse the CloudService1.cspkg file.

alt text

-----------------------------------------------------------------------------------------

Step 23: Browse the ServiceConfiguration.cscfg file.

alt text

-----------------------------------------------------------------------------------------

Step 24: Once both files have been selected, give name to this deployment and Click on Deploy button.

alt text

-----------------------------------------------------------------------------------------

Step 25: Then it will try to copy the files. alt text

-----------------------------------------------------------------------------------------

Step 26: Then it will try to enable the deployment

alt text

-----------------------------------------------------------------------------------------

Step 27: Once deployment is enabled click on Run button.

alt text

-----------------------------------------------------------------------------------------

Step 28: Then deployment will go through following three states.

alt text

alt text -->alt text --> alt text

Once you get ready state you are through. :-) Click on "Web Site URL" and your cloud app will open in new browser window.

Please let me know if you get following loop

Initializing ---> Busy --> Stopping ---> Initializing--> so on..

like image 91
Kushal Waikar Avatar answered Oct 12 '22 05:10

Kushal Waikar


There's a very good walkthrough posted about 2 weeks ago here that takes you through the migration steps, including migrating a SQL Server database to SQL Azure.

If you don't have an Azure account already, you can go here to set one up.

If you're an MSDN Premium member, you're eligible for a free Azure hosting account. See my SO post here for more info about this.

like image 26
David Makogon Avatar answered Oct 12 '22 05:10

David Makogon