Understanding Windows Azure Application



An application designed and developed to be a hosted service for Windows Azure consists of:

  1. Managed Code
  2. XML file for configuration

Managed codes are mapped into different Roles.

XML files are mapped into different configuration settings.

If we see the following diagram, it explains all the components mainly involved in Windows Azure application.

Azure1.gif

Note: This image is taken from the Windows Azure SDK

We will examine each component of the above diagram one by one.

The first thing is Roles

There are there types of Roles
  1. Web Role
  2. Worker Role
  3. VM Role

Web Role
  1. This is a role customized for IIS.
  2. If we choose this type of Role then IIS automatically configures for this.
  3. This role mainly takes input.
  4. This role is configured for HTTP request.
  5. This contains web sites or other codes that is supported by IIS.
  6. This mainly contains ASPX pages or it may contain WCF Services also. Any application supported by IIS can be used as Web Role.
  7. Any application can be used as Web Role if it supports HTTP protocol.
  8. When we use WCF Service for Web Role in Windows Azure we need to make sure that binding used in WCF service is basicHttpBinding. We cannot use another binding with WCF Service as Web Role.

Advancement in Web Role in Windows Azure SDK 1.3
  1. It got full capability of IIS.
  2. Web Applications and sites run fully under IIS.
  3. Web Roles uses the application domain in the same way as of IIS.

The biggest advantage is that now we can have multiple sites or applications in a single Web Role.

While creating an Azure project we can select the type of Web Role we want for the application. Installed templates are:
  1. ASP.Net Web Role
  2. ASP.Net MVC Web Role
  3. WCF Service Web Role
  4. CGI Web Role

    Azure2.gif

On creation of Windows Azure project, you can see there are two types of configuration files created for you.

Azure3.gif

In ServiceConfiguration.cscfg file, we can give the number of Web Role instances.

Azure4.gif

Worker Role

It is mainly useful for background work. The main point to be noticed here is that the Worker Role does not support IIS. So it is very much possible to process any type of application including unmanaged code. Worker role does not directly interact with the user so it is very useful for asynchronous long processing task.

Mainly Worker Roles are useful
  1. Useful in the task where user has not to wait for.
  2. Useful for asynchronous tasks.
  3. Useful to run non HTTP service like TCP services.
  4. To host the application does not require user input.

    Azure5.gif

Difference between Worker Role and Web Role

Let us understand some differences between Web Role and Worker Role
  1. Web Role is web application which gets HTTP Input from the user and is supported by IIS. Worker Role has not supported IIS. This is the main difference between Web Role and Worker Role.
  2. Web Role faces the user interface whereas Worker Role gets input from Web Role and mainly performs the batch operations asynchronously.
  3. In Web Role Threading is managed by IIS whereas in Worker Role Threading is managed by developer or ourselves.
  4. In Worker role we must need to provide Run method to start the process.
  5. The security parameter is not the same between Web Role and Worker Role.
  6. ACL [Access Control List] for certificates is supported by default for IIS and network services by default whereas in Worker Role developer has to manage it.

In csdef file the Worker Role is defined as below; the name of the worker role is WokerRole1 in the following configuration.

Azure6.gif

Worker Role class mainly contains two methods

Azure7.gif

VM Role

The third type of role is VM Role. This is a very special type of role and it mainly deals with operating system up gradation in virtual machines.

Web Role and Worker Role run on a virtual machine whereas VM Role is a virtual machine which gives full control of the operations on virtual machines.

Using VM Role we control the operating system and any up gradation in virtual machine operating system is instance of VM Role. This role is suited for migrating application to run as hosted service in Windows Azure.

A VM Role can be defined as:

<VirtualMachineRole name="MachineRole" vmsize="Medium">
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
</VirtualMachineRole>

Configuration files

Now we have understood the three different types of Roles. Let us have a look at two types of configuration files involved in Windows Azure Application.

Azure8.gif

ServiceConfiguratiobn.cscfg

The Configuration file can be updated without stopping the Azure service. This file mainly contains information about
  1. Number of Role instances
  2. Value for the different types of setting.

    Azure9.gif
     
  3. Instance count says number of instance of the Web Role or Worker Role will be running.
  4. In above configuration file we can see that application is using local development.

ServiceDefinition.csdef

This file contains the following information
  1. Various ROLES used by the service
  2. Information about Certificates used in the service.
  3. Input and Internal End Points for the service
  4. Local disk storage needed by the service
  5. Configuration setting that would be used by different Roles.

This configuration file defines the Web Role or Worker Role. Let us understand each segment of this file one by one.

Azure10.gif

This segment contains the definitions for site and web applications. These sites and web applications are hosted in IIS 7.

Azure11.gif

There are two types of End Points in this configuration file, Input End Point and Internal End Point.

Input End Point contains the definition of endpoint that is used to contact hosted service.

Internal End Point contains the definition that is used by roles to communicate with each other.

Azure12.gif

This segment contains the certificate needed for a role.

Azure13.gif

This segment contains the definition of imported rules.

Storage Service

The last segment of Azure Application is Azure Storage service. There are three types of Azure services.
  1. For unstructured Data (BLOBS)
  2. For structured Data ( TABLES)
  3. For messages between application and services (QUEUES)

BLOBS are mainly for used for large storage of Data. There are two types of BLOG storage, Block BLOG and PAGE BLOB. Azure Tables are used to store structured data. CRUD operations can be performed using ODATA protocol or using the same syntax used for WCF Data Service. Each row in the Azure table uniquely identified by Row key and Partition Key.
 
SQL Azure

For storage purpose we can use SQL Azure also.

Conclusion

In this article we saw an introduction of Windows Azure application. This article was more of theoretical. In the next article of this series we will explore Windows Azure applications in a walkthrough way. Thanks for reading.

Up Next
    Ebook Download
    View all
    Learn
    View all