Simple 5 steps to run your first Azure program


Introduction

In this article we will look in to 5 basic steps which will help us to run our first azure program. In this article we will understand how to create a simple web role application and while doing the same we will understand some development concepts of Azure.

In case you are new to azure do have a look at my azure FAQ for beginners @ :- 

http://www.c-sharpcorner.com/UploadFile/shivprasadk/456464508022009133329PM/4564645.aspx?ArticleID=1b39e15a-23d4-455d-bc87-656330546d6e

If you are really lazy like me you can download my two azure basic videos which explain what azure is all about Azure Faq Part 1 :- Video1 , Azure FAQ Part 2 :- Video2.


Please feel free to download my free 500 question and answer eBook which covers .NET , ASP.NET , SQL Server , WCF , WPF , WWF@ http://www.questpond.com  .

So let's start with the 5 basic steps. By the way when I wrote this article it was 31st December, 10:30 evening, so Happy New Year and blast yourself. Do not drink and drive , just drink , drink and sleep.


Windows azure works only on Windows 7, Windows Server 2008 and Windows Vista. It does not work on XP currently. So ensure you have one of the above mentioned operating system. Developers who are on XP do not attempt it, I have tried heavily but there is no way currently to execute Azure on XP. There are lot of hack which are given online, believe me none of them work.

From visual studio aspect ensure you have VS 2008 or VS 2010.


Windows Azure SDK simulates Azure hosting environment in your PC, so that you can develop your applications locally and then upload the online. So the first step is to download the SDK.

http://www.microsoft.com/downloads/details.aspx?FamilyID=772990da-8926-4db0-958f-95c1da572c84&displaylang=en 

Once you install Windows Azure you should see two menus one of the development fabric and the other of the development storage.
 

1.jpg 
You can also see the fabric and storage running on your task bar.

2.jpg
If you click on the same you should be able to see the fabric and storage as seen in the below figure.

3.jpg

Step 3:- Download Windows Azure tools 

We will need the cloud service visual studio template to speed up development in visual. So click on the below link to download windows azure tools which will install the template in visual studio.

http://www.microsoft.com/downloads/details.aspx?FamilyID=6967ff37-813e-47c7-b987-889124b43abd&displaylang=en

If windows azure tool is successfully installed you should get the cloud service template as shown in the below figure. 

4.jpg

Step 4:- Create the project

Once you have the cloud service template in your visual studio environment, click on it and select the 'Web role' as shown in the below figure. There are two kinds of basic applications you can create on azure 'Web role' and 'Worker role'. Web role are nothing but web application while worker roles are back ground processing applications like windows processes.

To keep it simple we have currently selected 'WebRole'. 


5.jpg
Once you are done you should get two projects as shown below. Once project is the cloud service project and the other is your web application. Cloud service project has associations to web and worker role projects.


6.jpg
The cloud service has two files 'ServiceConfiguration.cscfg' and 'ServiceDefinition.csdef'.

The 'ServiceDefinition.csdef' file contains the metadata needed by the Windows Azure fabric as per your application needs. It will also contain configuration settings that apply to all instances. .

The 'ServiceConfiguration.cscfg' file lets you set the values for the configuration settings and the number of instances to run for each role. So you can define some parameter called as 'ConnectionString' in your definition file and set the value in the configuration file. 

Step 5:- Run your application

In order to keep this simple just run the project as it is. Your application will run as shown in the below browser and at the back ground fabric will create virtual instance in which your application runs. The below figure shows the virtual instance created by fabric to run your application. 

Figure7.JPG 
In order to understand the power of azure configuration, go to the service configuration file and change the instance to 2, you should see two instances of your web role running as shown below. 

8.jpg 


Similar Articles