Q27. Describe a web role and a worker role in a development scenario?

A Windows Azure application can be developed with a combination of Web roles and Worker roles. Remember, you can develop a web role and a worker role using the same languages and tools as you would use for a Windows application. Azure offers flexibility by allowing a developer to develop the Worker role in one language and the Web role using the same or any other language, even a non .Net language such as Java.

To make development easier, Visual Studio provides project templates for creating Windows Azure applications. These are Web role and Worker role Templates. Some of the templates are ASP.NET Web Role, ASP.Net MVC Web role, WCF Web Role, Silver light Business Application, Worker role, Cache Worker role and Worker role with Service Bus Queue.

cloud service templates

When we use these templates in our cloud service project, we get a ‘ready to use framework’ of code which gives us a jumpstart in application development.

To create a Cloud Service project, add web roles and worker roles to the project using the web role and worker role standard templates provided in the VS.

role designer

After we develop the cloud application using web roles and worker roles, we also specify the settings in the service configuration file needed to run the application as a cloud service. We can set the number of instances of each role in the service configuration file. When we deploy this project package onto Windows Azure cloud, corresponding web role and worker role instances specified in the configuration file are created.

Important words:

Project Template

A template is a predefined standard format using which we can speed up the application development process. A project template is a predefined standard format consisting of a combination of classes and interfaces and ready code to jumpstart the application development.

Service configuration file

When a project is created in VS, ServiceDefintion and ServiceConfiguration files are created. ServiceConfiguration file can be configured by Azure developer by specifying the number of VM instances for each web role and worker role, size of VM and a connection string required to connect to the azure storage service.