Search
Close this search box.

Moving your ASP.NET Application to Windows Azure – Part II

In the previous post I had described the steps to secure your Windows Azure tokens and get the necessary Visual Studio templates as well as making your web application Azure ready by adding the cloud project and building against it.

Once you have tested the Development Fabric, the instances as well as the application, the next step would be to publish it to the Windows Azure platform.  Select the “CloudService1” project that you added to the solution, right click and select “Publish”

Once you click on “Publish”, if you are connected to the internet, it would try and open up Azure login screen and once you sign in, https://windows.azure.com/Cloud/Provisioning/Default.aspx

If you had received the Windows Azure Tokens, and claimed them (as per my previous posts), you would hit the screen as below upon clicking on your project. 

in the above, once you click on “New Service” it opens up the page to choose the type of service you would want to create. 

As mentioned earlier, in the CTP you would get to create 2 storage accounts and one hosted service.  In our case, we would require a hosted service, so select the same and proceed to the next screen.  It would provide you the option to specify the Service name and description (note both are mandatory)  I have provided a name as well as description as per the screen below.

Clicking on next would take you to the screen where you can choose the sub-domain name.  Provide the name and “Check Availability” and then leave the default and click on “Create”. 

The next screen opens up with details of the stuff entered so far, as below:-

Click on “Deploy” and it would open up the next screen to upload your configuration files.  When you selected “Publish” in the first step, it would have also opened up your solution’s “Publish” folder automatically.  You can take that path to browse to the CloudService1.cspkg file for the first file upload control and the ServiceConfiguration.cscfg for the second and also provide a label for the deployment.  After that Click “Deploy”

This process would take some time and then get to the following screen.  (If you get an error here, mentioning the role instances are out of range, make sure you changed back the number of roles in your configuration file as mentioned in my previous post to “1” which is default.  The current CTP limits it to 1 instance and although you can change it locally to any number to see the instance simulation in development fabric, when you publish and go to production in the CTP, it doesn’t permit more than 1.  So, change the configuration, rebuild and then publish to get the updated configuration files which you can replace)

Note that at this stage the application is “Stopped”.  You need to explicitly click on “Run” to start the application.  This would start enabling the Deployment and takes a few minutes based on the server availability and then gets to the “Initializing” stage where the icon (blue) changes to Yellow as well as status to “Initializing”

At this point the custom URL with our sub-domain (in this sample, http://harishweb.cloudapp.net) would not be available since its is still initializing.  Once that is done and it indicates “Ready” as below, you can access the URL to see your app running on the cloud.  You can also “Suspend” and do other things from this screen later.

So, with that we have deployed our ASP.NET application to cloud.  If you had followed the Part I and Part II of the SQL Azure migration as well, your application is now running UI Layer on Windows Azure and SQL Layer on SQL Azure.  That makes it a truly cloud based solution.  Here below in a screen shot of my application running on Windows Azure with my custom sub domain i.e. http://harishweb.cloudapp.net (note, I would delete the service shortly and hence this URL wouldnt be available.  since the CTP offers only one hosted service, i would keep it available for me all the time by removing the apps as and when i am done with demo 

I hope you found these posts beneficial and do point out if there are errors / omissions in the steps.

Cheers !!!

This article is part of the GWB Archives. Original Author: Project Cool

Related Posts