Monday, January 19, 2009

Windows Azure Application Development -Part2

In my previous Blog  Part-1 I was explaining how to setup a Windows Azure Application Development Fabric  environment. In this Blog I am going to show how to create and  deploy a Azure Web Cloud Service Application using VS.NET 2008 in local Fabric development Environment.

1) First let's  fire up VS.NET 2008 IDE and create a new project template  selecting could Service project type as show below.


Once project is created successfully, If you look at the  Solution Explorer  projects files it's look like we have created  a ASP.NET Web application .  apart from that we see some additional files  like   ServiceDefinition.csdef , ServiceConfiguration.cscfg


ServiceConfiguration.cscfg is  Cloud Service Configuration file. In this file were the  configuration settings and the number of instances to run for each role as specified.

ServiceDefinition.csdef  is cloud service definition file . This file contains metadata for the Cloud Service.

Now open up the Default.aspx  and place one Label ,TextBox and One button (ASP.NET Server controls) in ASP.NET Web Form.


Now Execute the Cloud Service pressing F5,  and Launch the Local Development Fabric from Task bar ,


Hey we are successfully created and deployed our first Windows Azure Web Cloud Service.  if you select the Service Details Node in the Service deployments tree that basically has   Role and Port  information .

// Service Definition file.

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="SreeniCloudService" xmlns="">
  <WebRole name="WebRole">
      <!-- Must use port 80 for http and port 443 for https when running in the cloud -->
      <InputEndpoint name="HttpIn" protocol="http" port="80" />



This cloud service is running  at in local development Fabric environment.

In Could computing environment we can not attach debugger to the application in real time and debug the code , so the only way we can debug the application is logging the Information in event log will help to find the application errors. Here is how we can do this in Cloud Services.

Now lets add logging information to this cloud service .  I am going to log the Text which is entered in  Name Text box to the Event Log.  To do this  we are going use class called  RoleManager.

Here is the namespace which has the RoleManager class 


RoleManager class provides the WriteLog method to write the log.


Now we are going to add the following code in  Print Button Click event.

RoleManager.WriteToLog("Information", TextBox1.Text);






1 comment:

Anonymous said...

ITSolusenz departments manage all components of software development including, Application Development Company, software development company india, Software Development Services.