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:
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…
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.
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:
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.
You will see two type of service available:
- The Storage Account which provides persistent and non-persistent storage. We can use Blob, Table, Queue, and Drive on the Azure Storage Account.
- 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).
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.
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 .
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.
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
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.
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.
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 button. 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.
Take a look and click also at the friendly-name URL to see the result.
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 firstname.lastname@example.org. I would be happy to help you .