An application designed and developed to be as hosted service for windows azure consist 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 below diagram it explains all the components mainly involved in Windows Azure application.
Note: This image taken from Windows Azure SDK
We will examine each component of 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
1. This is role customized for IIS.
2. If we choose this type of Role automatically IIS setup is configured 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.
Biggest advantage is that now we could have multiple sites or application is a single Web Role.
While creating 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
On creation of Windows Azure project, you can see there are two types of configuration files created for you.
In ServiceConfiguration.cscfg file, we can give the number of Web Role instance
It is mainly useful for background work. The main point to be noticed here is that Worker Role does not support IIS. So it is very much capable to process any type of application including unmanaged code. Worker role does not directly interact with the user so it is very useful when it come 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.
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 it 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 same in 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 Worker Role is defined like below , name of the worker role is WokerRole1 in the below configuration
Worker Role class mainly contains two methods
Third type of role is VM Role. This is very special types 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 below
<VirtualMachineRole name=”MachineRole” vmsize=”Medium”>
<Import moduleName=”RemoteAccess” />
<Import moduleName=”RemoteForwarder” />
Now since we have understood the three different types of Roles. Let us have a look on two types of configuration files involved in Windows Azure Application.
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.
1. Instance count says number of instance of the Web Role or Worker Role will be running.
2. In above configuration file we can see that application is using local development.
This file contains below 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.
This segment contains the definitions for site and web applications. These sites and web applications are hosted in IIS 7.
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.
This segment contains the certificate needed for a role.
This segment contains definition of imported rules.
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.
For storage purpose we can use SQL Azure also.
In this article we saw an introduction of Windows Azure application. This article was more of theoretical. In next article of this series we will explore Windows Azure application in a walkthrough way . Thanks for reading.