Building cloud applications for Windows Azure
Azure development will become a part of Visual Studio 2010 to be released soon. Until then, you can download Azure SDK and Azure tools & use them in Visual Studio. Here we will create and deploy a Cloud application on Win Azure
Wednesday, December 16, 2009
Creating Cloud application in Visual StudioCreating a new Cloud Service project in Visual Studio will create two projects for you in the solution (see second image). If you look into the Solution Explorer, the first project is (forPCQuest) where application configuration setting for Cloud is stored. Other project is a simple ASP.NET web application (WebRole1). Service Definition (.cscdef) file in the first project is used to provision Web application 'as a Service' for cloud. To achieve this, the XML tag used is:
Once the Web Application is added as a service as mentioned above, we can set configuration settings for our Web Application in Service Configuration file (.cscfg). If you open Service Configuration file, you will see the following code:
This file describes what setting your web application will use when deployed on the cloud. Checkout the instances count setting, for example, that allows you to configure the scalability requirements. This is interesting to see how you can dynamically increase the load capacity of your web application on-demand. This is one of the promises that Windows Azure delivers.
Now, let's open our Web application (WebRole1) and make some changes in it. If we open Defualt.aspx file and add the line:
Welcome PC Quest Reader
In order to build our application, we can right click and select Build or directly select Publish option that will first build the application and then attempt to publish it (see the above image). If we select the publish option, it creates a 'publish' directory somewhere at the same place where the project source files are stored and creates two files. These files are 1. Service package file which has our Web Application in Cloud deployable format, and 2. Cloud Service Configuration file which consists of configuration settings for Cloud that our Web Application will use. Also, the Visual studio will automatically open browser and point to a URL https://windows. azure.com/Cloud/ Provisioning/Default.aspx where you can provision your small Cloud application that you have just built.
 |
| A cloud application can be hosted on windows.azure.com. The first step is to define a URI on Internet so that your cloud application gets a Unique Internet address. |
You may like to test your application locally on your machine before you deploy it to http://windows.azure.com. In order to do that, just select the Cloud project and hit 'Ctrl + F5'. You will notice two small icons on the right side of your status bar ? these are 'Development Fabric'and 'Development Storage'. These are nothing but a local implement of Windows Azure with all the necessary services to deploy and test a Cloud application locally.