Sunday, March 14, 2010

Developing and Hosting Application in Windows Azure

Microsoft Announced Feb 1 2010 Azure Services pricing Model.  To host our application on the Cloud first we need to get Account. so go to

WWW.Microsoft.com/WindowsAzure  click Azure Platform Introductory Special this model offer no cost until Jun 30. click buy button and provided Billing information with CC Information.

Creating Account

image

Once you Create the account you get the following Conformation email

Dear S.Ragavan Ramadurai,

Thank you for your purchase of order 180xxxxx541.

If your subscription has not yet been activated, follow these steps:

  1. Sign in to the Microsoft Online Services Customer Portal with the following Windows Live ID: someid@hotmail.com.
  2. Open the Subscriptions page and find your subscription.
  3. From the Actions list for each subscription, select Activate now, and then click Go.

This message was sent from an unmonitored e-mail address. Please do not reply to this message.

Sincerely,
Microsoft Online Services Team

To contact Microsoft Online Services Support, go to online support

Microsoft respects your privacy. Please read our online Privacy Statement

Trademarks

image

Download Development SDK

Once your account is activated now download the Tools and SDK to develop the windows Azure Services.

image

Developing and Hosting

Now i am going to show how to host simple ASP.NET application on Microsoft Cloud OS(Azure).  Microsoft provides AppFabric for  developing  Azure development  in Local machine once test it then move to cloud. This App Fabric installed when  Azure SDK installed.

image

Fire up VS.NET 2010 RC ( you can use VS.NET 2008 SP1) and select cloud Project as shown below ( I am using C# as my development Environment )

image

Windows Azure application Must have at least one Web Role or Worker Role. here i am going to add ASP.NET Web Role. All Web Roles are user facing application but worker role only accept incoming Request no outgoing .

image

Click ok This will create two projects as shown below.

The first project, named SreeniFirstAzureApp, holds the configuration for the  our web role that compose the Windows Azure application. It includes the service definition file, ServiceDefinition.csdef, which contains metadata needed by the Windows Azure fabric to understand the requirements of our application, such as which roles are used, their trust level, the endpoints exposed by each role, the local storage requirements and the certificates used by the roles. The service definition also establishes configuration settings specific to the application. The service configuration file, ServiceConfiguration.cscfg, specifies the number of instances to run for each role and sets the value of configuration settings defined in the service definition file. This separation between service definition and configuration allows you to update the settings of a running application by uploading a new service configuration file.
The Roles node in the cloud service project enables you to configure what roles the service includes (Web, worker or both) as well as which projects to associate with these roles. Adding and configuring roles through the Roles node will update the ServiceDefinition.csdef and ServiceConfiguration.cscfg files.
The second project, named SreeniWebRole, is a standard ASP.NET Web Application project template modified for the Windows Azure environment. It contains an additional class that provides the entry point for the web role and contains methods to manage the initialization, starting, and stopping of the role.

 

image

Now open the Default.aspx and add some HTML save the file now compile and execute the app.

image 

Now our Windows Azure application under local Development fabric. 

image

Suppose we wanted to run 5 instance of this application just change the Instances value in ServiceConfigration file as shown below.( save the file and run the app)

image

Now local Development Fabric shows there are 5 instances will be running.

image

Publish

Now we are happy with our Windows Azure application running under local environment now we are ready to publish on the cloud.  To publish or to host on the cloud right click on the project  and click publish as shown below.

image

It opens up IE with Windows Azure Platform site . Now you need to Login to the site with your Windows Live id which is used when creating Azure account. Once you login click create new service.

image

The next screen we need to select Hosted Services.

image

Give service Label name and Service Description.

image

I am going to host my service anywhere in the US Region. so select the region and click create.

image

Now it will shows two Environments to deploy our Windows Azure application . Click the Deploy on Staging ( First deploy in staging  right way to deploy  ).

image

when click deploy button it opens up  Windows File Explorer now we need to point the our application directory and select the Application Package file and Service configuration file to deploy.

image

image

Now click to deploy.

image

image

Now our application is deployed and hosted in Windows Azure OS. now we need to start the app just clicking Run button.

Now you will see Initializing…

image

Now it says Busy

image

Now Application is ready to run.

image

The following screen shot shows my Application running successfully on Staging Environment . when application in staging you get the application URL as some GUID.image

Now i am going to promote my Application to Production just click the following Icon.

Promote from Staging to Production

image 

image

Now my application promoted from Staging to Production. Now the application URL will be

http://sreeniramadurai.cloudapp.net/

image

Application runs successfully in production as well.

image

Nandri(Thanks)

SreenivasaRagavan.

2 comments:

kishore kumar said...

Nice

Sandy said...

This post is very useful to Create the own account and developing the application hosting. Thanks