Windows Azure Training Series: Understanding Azure Roles

This is the fourth in a series of Microsoft Windows Azure training articles. In the last article, Windows Azure Training Series: Creating Your First Azure Project, we created a simple Azure application and in the next article we will deploy it. First, we need to understand Windows Azure roles though.

Windows Azure Roles Overview

To use Windows Azure, you first need a subscription. Once you have a subscription, you can create what are called hosted services. A hosted service is equivalent to an application. You might want to see the first post in this series, Windows Azure Training Series:  Understanding Subscriptions and Users, if this is new to you.

Each hosted service consists of one or more roles, and each role runs on one or more instances. Each instance is running in a Windows Azure virtual machine, which is running a version of the Windows Server operating system.

In the screenshot below, “Course 2602” is a subscription. There are 3 hosted services; “Flash Cards hosted Service”, “Hello Version 2” and “Doug’s Pretty Good Service”. Only “Doug’s Pretty Good Service” has anything deployed to it. It consists of one role “DougsPrettyGoodWebsite”, and there is one instance of that role running.

Windows Azure Role Types

When creating a Windows Azure project in Visual Studio, you add one of more roles to the project. The dialog shown below allows you to choose the roles, as we saw in the last article. Notice there are 5 choices for roles. However, there are really only 2 different kinds of roles, Web roles and worker roles. There just so happens to be 4 different ways of creating Web roles, hence the 5 choices.

Windows Azure Web Roles

A Web role, once deployed, is really just a Web application that is configured under the instance of IIS that is running in the Azure virtual machine. You can choose to create the Web application using ASP.NET or ASP.NET MVC. If you prefer PHP, choose the CGI Web role.

If you want to create Web services you would choose WCF Service Web role. Web services are configured under IIS just like the other Web roles.

Windows Azure Worker Roles

Worker roles are background services, running some task periodically. Worker roles are really simple. The role starts and just runs in a loop. Each iteration through the loop the worker process looks to see if it has something to do, and if so performs its task. If not, it goes to sleep.

Typically, communication between Web roles and Worker roles is done using a message queue. Kevin Kell wrote some articles about this. See Worker Role Communication in Windows Azure – Part 1.

Configuring Windows Azure Roles

Roles must be configured before deploying them. This can be done directly in the configuration file, or you can use the Visual Studio properties pages as shown below.

The most important things you need to configure are VM size and instance count. VM size determines the amount of computing resources that are allocated for your virtual machine(s). Instance count determines how many VMs you get per role.

Summary

Now, we’re ready to deploy a role to the Windows Azure cloud. I’ll cover that in my next post.

To learn more about Windows Azure, come to Learning Tree’s course, Windows Azure Platform Introduction: Programming Cloud-Based Applications.

You may also be interested in other courses in Learning Tree’s .NET programming curriculum.

Doug Rehnstrom

Type to search blog.learningtree.com

Do you mean "" ?

Sorry, no results were found for your query.

Please check your spelling and try your search again.