Step-by-step: Migrating ASP.NET Application to Windows Azure (Part 4–Deploying to Windows Azure)

This is the fourth post of Migrating ASP.NET Application to Windows Azure series. As usual, I encourage you to check out the rest of my posts before reading this post:

  1. Step-by-step: Migrating ASP.NET Application to Windows Azure (Part 1 – Preparing the ASP.NET application)

  2. Step-by-step: Migrating ASP.NET Application to Windows Azure (Part 2 – Preparing SQL Azure Database)

  3. Step-by-step: Migrating ASP.NET Application to Windows Azure (Part 3 – Converting ASP.NET Web site to Web Role)

In this post, I’ll deploy the web role that we’ve successfully converted in the third post.

1. Right click on the cloud service project and select Publish…

image_7C580A01

2. VS will need a few seconds to compile and package your application into 2 files: [name].cspkg and ServiceConfiguration.cscfg.

[name].cspkg is a package file that contains all of your source codes, dll, and contents file. ServiceConfiguration.cscfg is the configuration file that define our cloud service project. Before uploading it to Windows Azure, it’s possible for us to do some changes on the ServiceConfiguration.cscfg by opening it up with any text editor.

At the end, it will also open up a browser page that refer to Windows Azure Developer Portal and also open up a windows explorer that navigating to the location of your package files.

 image_156D0A4B image_6D9208BA

3. Assuming that you have an account and have sign in to Azure Developer Portal, the next step is to select the project. Do note that, it’s possible for one account to have more than one project, as you see in my example here:

 image_781EEEA8

To proceed, I’ll select my MSDNAzure11July2010 project. Of course you can name of the project when performing subscription process.

4. When you have selected the project, the next step is about the service. If you’ve created the service before,you’ll see a list of available service. To avoid any confusion,I’ve cleared all of my existing services. Click on New Service link to create the new service.

image_5B452DF9

You will see two type of service available:

  1. The Storage Account which provides persistent and non-persistent storage. We can use Blob, Table, Queue, and Drive on the Azure Storage Account.
  2. Hosted Service which is the cloud service OS that allow us to deploy our Windows Azure role to the cloud.

Since in the previous demo, I didn’t use any storage account, I am not going to create the Storage Account service. Instead, I’ll select the Hosted Service.

5. The next step is to enter the Service Label as well as the Description (which is actually optional).

image_2F4468A3

I enter Personal Service as my Service Label and some description that explain what the service is all about. Click on Next button to proceed.

6. On the next step, we are prompted to enter the Hosted Service URL as well as Affinity Group.

image53_7E415554 image_06492DCD

Windows Azure will provide us a URL domain with suffix .cloudapp.net. All we need to do is to ensure that the public service name must be globally unique. Note that, it’s possible for us to set our desired custom domain in provider such as GoDaddy or DynaDot. In the example, I’ll enter welypersonal as the public service name.

Next step is about setting the Region and Affinity Group. Affinity Group allows Windows Azure to place our hosted service with other service (storage or any other hosted service) in one place to enable the better performance and connectivity. If your service is hosted with association to any other service, you will need to consider creating an Affinity Group, then subsequently the region. Otherwise, we can just proceed to set the region. Currently, there’s 6 available region to be chosen as following. It’s believe that Microsoft will continue to invest more data center in the future.

Since my application is not associated with others, I’ll choose not to use any Affinity Group. Furthermore, I’ll select SouthEastAsia as my region. Click on the Create button when you are ready to go.

7. After a few seconds, you will be seeing the following screen. Yeah, this is to deploy your application to Windows Azure. Note that, Azure provide you both Staging and Production version to deploy. You can first deploy to staging environment. When everything is going well, then promote it to Production. However, even though staging environment, the charge will be still applied BOTH because in principle, you still use Windows Azure’s resource Sad smile.

image_4F0F7A06

8. Assuming we want to deploy to the staging environment first. The subsequent step is to deploy the package. To do that, click on Deploy… button.  It then will bring you to another page. Upload the application package .cskpg file as well as configuration settings .cscfg file.

image_0303CDC0image_6F725A1F

At the operation system settings, you can select the guest OS version of Windows Azure. Note that, there’re few release of Windows Azure Guest OS. You can then enter the deployment label to note down the version of your deployment. Click on Deploy button when everything is ready.

It may take sometime to deploy the package depends on the size of you’re the deployment package.

9. A few moments later, you will see the following screen

image_4AFD0436

The screen indicates that your application is now deployed but on suspended status. Take a look at the WARNING section above that remind you about the charge. Right, it will still charge you even though your application is suspended. So make sure you delete the deployment to avoid the charge when not needed anymore.

The next step is to enable the service. To do that, simply click on Run button.

10. After a few moment, you probably see the status become Initializing and later Busy.

image_75E17A16

What actually happened is Windows Azure is allocating our deployment on appropriate machine that satisfy the load of each physical machine. Additionally, if you set your instance to more than 1, it manages the load balancing mechanism so that when the load increases, Windows Azure will intelligently load balance your application.

11. After a few minutes, if you see the status become Ready like the following, that’s great. It means your application has been successfully deployed. Congratulation! You may want to click on the URL to test it. You will see the ugly name of my URL like mine. That’s actually apply when we use the staging version of the deployment. The URL will be change into more friendly one as what we’ve defined before when we promote it to production.

  image_03EF81A0 image_528A41B2

However, sometimes it may not be successful as you will probably see the status keep stuck at Initializing – Busy – Stopping. I recommend you to check out MSDN Forum or MSDN library to work out from the troubleshooting.

12. If your application runs well at staging, you may want to promote it to production by clicking on this image_6009B1DCbutton. Click on Yes if there’s prompt to ensure we want to promote it to production environment. After a few moment, we are happy to see the following screen that indicates our successful deployment.

image_1E93F5BB

Take a look and click also at the friendly-name URL to see the result.

image_528A41B2

Alright, I’ll keep the website active for a few weeks / months. If you find that it doesn’t work anymore and you want to explore about it, please let me know by sending me an email at wely_live@live.com. I would be happy to help you Smile.

See you!

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*