Click here to Skip to main content
Click here to Skip to main content
Go to top

Create and Deploy Windows Azure Application

, 31 Jul 2011
Rate this:
Please Sign up or sign in to vote.
How to create and deploy a Windows Azure application.

Well we have lots of Blog post which gives us how to deploy our .NET apps on Azure, but I just tried to describe it in my way using more Images which will give much clear understanding(a picture speaks thousand words!!!).

Ok, so to start with first you need to have Windows Azure Access, you can request for Trial licence here. Then for .NET developers will have to download the Azure SDK 1.4 (April 2011) using this link. And of course you need Visual Studio 2010 SP1, you can download it from here. Please note Windows Azure SDK is not compatible with Express editions of VS2010 IDE.

Now run the Visual Studio 2010 in elevated mode, i.e. you have to right click the Visual Studio 2010 icon in Program Files and Select “Run as Administrator”. Once you got the IDE you have to Select New Project and Select Cloud from the left menu, and Select Windows Azure Project from the right Selection menu. I am selecting this as C# project but you can select VB.NET too.

image

Name you application as you like, I named it as FirstWindowsAzure, and selected Ok button.

.image

Once you say Ok, this will show another window providing you with different options to select from. I am not going into very depth of each and every Roles, just to give you brief idea,

A Windows Azure role is an individually scalable component running in the cloud where each instance of a role corresponds to a virtual machine (VM) instance.

There are two types of role:

  • A Web role is a Web application running on IIS. It is accessible via an HTTP or HTTPS endpoint.
  • A Worker role is a background processing application that runs arbitrary .NET code. It also has the ability to expose Internet-facing and internal endpoints.

We also have a special type of Role called as VM Role. You can get more details on MSDN Link about Architecture of Windows Azure Roles.

To keep it simple and focussed I have created a WebRole and named it as MyFirstApp. Once I say Ok my Solution looks something like as below.

image

It is easy to add or remove roles in the cloud service after project creation has completed. To add other roles to this cloud service, right-click on the Roles node in the cloud service and select Add -> New Web Role Project or Add -> New Worker Role Project. Selecting either of these options brings up the Add New Role dialog where you can choose which project template to use when adding the role.

You can add any ASP.NET Web Role project to the solution by right-clicking on the Roles node, selecting Add -> Web Role Project in the solution, and selecting the project to associate as a Web role.

To delete, simply select the role to delete and hit the Delete key. The project can then be removed.

Now coming back to my application. I am keeping all the default codes which was created by the designer and hit F5. Visual Studio will build your project, start the Development Fabric, initialize the Development Storage (if run for the first time), package the deployment, attach to all role instances, and then launch the browser pointing to the Web role.

image

You can see the notifications area of the taskbar shows the Development Fabric has started. The Development Fabric is a simulation environment that runs role instances on your machine in much the way they run in the real cloud.

image

Right-click on the Windows Azure notification icon in the taskbar and click on Show Compute Emulator UI. This will launch the Windows Azure Compute Emulator itself, which allows you to perform various operations on your deployments, such as viewing logs and restarting and deleting deployments. Notice that the Development Fabric contains a new deployment that hosts one Web role instance and one Worker role instance.

image

I hope up to this point you have not encountered any exceptions/errors. Now your sample  application is ready for deployment. If you have already got access to https://windows.azure.com then you can open the site using your credentials. Once you logged in successfully you will get nice UI build on Silverlight 4.0 interface. This is the new UI, you can switch back the old one too if you like.

image

To start the deployment process first you have to Publish the FirstWindowsAzure using the following options (Create Service Package Only). This will create the Package and Service Configuration named named FirstWindowsAzure.cspkg and ServiceConfiguration.cscfg respectively in \bin\Debug\Publish directory.

image

image

Now in the Web Interface of Windows Azure Platform, Select New Hosted Service from the Top Menu Ribbon

image

This will Popup the menu as below.

You have to choose the Desired Subscription, Provide Name, URL Prefix, Region, Deployment options, Deployment Name, Package location and configuration file location.

Since the domain cloudapp.net and is common for all the users prefix with the URL Prefix provided by you, so your prefix has to be unique and not taken by any other users. Select the Staging environment for testing purpose, Keep the Start after successful deployment checked. This will start your Service as soon as its get created. For Package location and Configuration files you have to Browse locally for the files FirstWindowsAzure.cspkg and ServiceConfiguration.cscfg respectively in \bin\Debug\Publish directory. If you enter the URL Prefix which is already taken then it will give you the following error.

image

Once you enter all the required information you can Click Ok in the popup. This will validate your information's which you have entered and may give you a warning, you can simply ignore this warning.

image

This will start creating your application. Once it finishes, your application is ready to browse and hosted in Cloud. Remember this process may take a while during this time don't refresh your browser.

image

image

Once your hosted service is hosted and started, the Azure service will generate a random id for staging environment, which can be used to browse your application remotely, as given below.

image

image

This is just the basics which I wanted to share in this Post, you can also refer to MSDN article Code Quick Start: Create and deploy an ASP.NET application in Windows Azure. Both post are very much similar. I just tried to give more pictorial representation of the same for much better understanding for those who are starting from scratch.

Note: For evaluation licence of Windows Azure you one limitation is you can create only one hosted services. So before winding up just to let you know how to delete the already created hosted services.

First you have to stop the Service you have created if any, once it stopped, you can see the Delete button gets enabled. Then you can comfortably delete the created service and create the new service.

image

Other very useful link : http://blogs.msdn.com/b/jnak/

Hope this helps.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Brij M
Technical Lead Mphasis Limited
India India
No Biography provided
Follow on   Twitter

Comments and Discussions

 
SuggestionTUTORIAL: Fast Web API Deployment on Windows Azure PinmemberJuan Carlos Pell26-Feb-14 22:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 31 Jul 2011
Article Copyright 2011 by Brij M
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid