For setup, see my blog “Azure Table Storage – Setup and Installation”
Introduction to Configuring for Azure Table Storage
The Thumbnails sample is a service that demonstrates a web role and a worker role.
What are web roles and worker roles?
A Windows Azure application can’t actually see the VM it’s running in.
A developer isn’t allowed to supply his own VM image for Windows Azure to run, nor does he need to worry about maintaining this copy of the Windows operating system.
Instead, the CTP version lets a developer create .NET 3.5 applications using Web role instances and/or Worker role instances.
Web Role – What is it?
Each Web role instance accepts incoming HTTP (or HTTPS) requests via Internet Information Services (IIS) 7.
A Web role can be implemented using ASP.NET, WCF, or another .NET Framework technology that works with IIS.
As the above figure shows, Windows Azure provides built-in load balancing to spread requests across Web role instances that are part of the same application.
Worker Role – What is it?
A Worker role instance, by contrast, cannot accept requests directly from the outside world—it’s not allowed to have any incoming network connections, and IIS isn’t running in its VM.
Instead, it gets its input from a Web role instance, typically via a queue in Windows Azure storage.
The result of its work can be written to Windows Azure storage or sent to the outside world—outgoing network connections are allowed.
Unlike a Web role instance, which is created to handle an incoming HTTP request and shut down when that request has been processed, a Worker role instance can run indefinitely—it’s a batch job.
Befitting this generality, a Worker role can be implemented using any .NET technology with a main() method (subject to the limits of Windows Azure trust, as described below)
Thumbnails Example – Web and Worker Roles
The web role provides a front end application for the user to upload photos and adds a work item to a queue.
The worker role fetches the work item from the queue and creates thumbnails in the designated directory.
The Front End
Building a front-end web site using ASP.NET web forms
Defining a web role
The Client uses REST
Calling REST API operations against Blob Storage and the Queue service