Introduction to Configuring for Azure Table Storage
We will be working on the Thumbnails example, which is installed with the Windows Azure SDK.
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
Built using Vista
Setting up your environment for Azure is critical to minimizing pain. Follow these steps carefully and you'll avoid unnecessary complications. I am assuming Vista. I realize this might not be everyone's preferred platform, but I have had nothing but great experiences developing on Vista. I haven't had to reboot in several days, even after uninstalling and reinstalling software.
The goal is to run some of the demo code that comes with Azure:
Necessary Software for Azure Table Storage
SQL Server 2008 Developer Edition
Visual Studio 2008 Professional
90 Day trial copy
Visual Studio 2008 Service Pack 1
Includes .NET framework 3.5 sp1
Windows Azure SDK
Windows Azure for Microsoft Visual Studio October 2008 CTP
SQL Server Express Edition
IIS 7 – Setup here is critical
From the Start menu, choose Control Panel | Programs | Programs and Features.
Build the samples
There is a buildall.cmd file.
C:\Program Files\Windows Azure SDK\v1.0\samples\buildall.cmd
Run Windows Azure SDK Command Prompt as administrator. It is important that you run as "Administrator"
Windows Azure SDK Command Prompt
I got errors if I did not run as administrator.
Creates a database with all the tables
Start SQL Server as Adminstroator
Note that SQLEXPRESS is used
Results of the CreateTables.cmd batch file
Note the various tables that were generated
Run the command "RunDevStore.cmd"
Thumbnails Example – A Highly Scalable Architecture
Not deploying out the cloud. Developing on the local developer fabric. The development fabric simulates the Windows Azure fabric on your local machine so that you may run and test your service locally before deploying it. The development fabric allows you to debug and fine-tune the behavior of your service before it is deployed.
This is a simple sample of 2-role service. These roles were previously explained in this blog.
The web role displays a collection of thumbnails in a designated directory
It also provides a photo upload facility
Uploading a photo will results in a workitem for "thumbnail making" created in the queue
Message will be placed in queue for worker role to "pluck"
The image will also be stored as a blob
The worker role fetches such jobs off the queue and creates the thumbnails in the designated directory
Pullls thumbnail out of blog storage put there by the web role
Thank you for submitting this cool story - Trackback from DotNetShoutout
Hi Bruno, I've got this sample running in my development fabric. There is still one piece that is 'magical' to me, and that is how the 'thumbails/' prefix is created in the photogallery blob container. Is it from the name of the service? It doesn't seem to be a part of the BlobProperties object.