When it comes to developing on Microsoft Windows Azure, it certainly is fun to experiment with new technologies as they emerge, implementing basic functionality for the benefit of your understanding. But if you’re like me, then when it comes time to build an Azure solution for a customer, you’re more interested in making quick, reliable progress than in demonstrating your ability to re-inventing the wheel. Therein lies the value of accelerator projects, which create Microsoft Visual Studio solutions that take care of most of the infrastructure work and are primed for your plug-in customizations. However, these accelerators can be a mixed blessing: What you get from the template is at times limiting, and when you encounter those limits, you might find yourself working harder to modify the template than you would have done had you simply started from scratch.
The solution is to leverage accelerators that help you with fundamental issues that you find yourself repeating from project to project—and then get out of the way. In this article, I review two such accelerators that tackle two very common scenarios. The first is the Windows Azure Accelerator for Web Roles, which makes easy work of deploying multiple websites to a single Azure web role and using the Web Deployment Tool (Web Deploy) to quickly iterate the cloud-deployed content. The second is the Windows Azure Toolkit for Windows Phone, which gets you past the repetitive basic code that you need to write to provide Azure-hosted notification services and access control for your Windows Phone 7 applications.
Windows Azure Accelerator for Web Roles
Creating and deploying a single website to Azure is quick and easy. But you can make the task even easier and more practical by using the Windows Azure Accelerator for Web Roles (let’s just call it the Web Accelerator, for short). This accelerator, which is available on CodePlex and was created by the Microsoft Developer and Platform Evangelism (DPE) Team, addresses two common challenges that Azure web developers face on almost every project: deploying multiple websites per web role and quickly deploying updates to Azure-hosted websites.
Let us start with the latter point, because it is quite compelling. The Web Accelerator cuts down the time it takes to deploy updates to your websites from 12–20 minutes to about 30 seconds! What’s more, the speed boost is not just for development deployments, but for production use as well. The Web Accelerator speeds deployment by leveraging Web Deploy. Instead of deploying a cloud package and reprovisioning entire web role instances each time you make an update, the Web Accelerator uses a Web Deploy package that updates the website contents in Microsoft IIS on all instances of the web role.
You might be thinking: But Web Deploy should be used only in development scenarios because it can target only a single role instance, right? Actually, the Web Accelerator also provides the infrastructure to correctly deploy updates to all instances within a web role. The magic that happens under the hood is as powerful as it is sensible. When you deploy from Visual Studio 2010, you use the Publish feature, which leverages Web Deploy directly on your web project (not on the cloud project). By using the Web Deploy Publish feature, you are actually publishing the new contents to a single Web role instance. However, the Web Accelerator solution includes within its web role a background process that monitors for changes in the website's file system. On detection, this process creates a new Web Deploy package from the website on the role instance and copies that package to Azure storage. The same background process running on other instances of the web role detects the new Web Deploy package, copies it locally, and executes the Web Deploy API to deploy the package to the local IIS instance.
Ultimately, the Web Accelerator is at least two Visual Studio solutions. The first solution has a cloud project that defines a single web role, which is responsible for performing the synchronization that I just described and for providing a management website for you to use to monitor and configure deployed websites (see Figure 1). The second solution contains your website, which can be developed in ASP.NET MVC 2, ASP.NET MVC 3, or even PHP—no cloud project in sight. You deploy multiple websites to the single hosted service and differentiate them by using host headers. Web Deploy uses Remote Desktop credentials to log in to the remote instances.
Windows Azure Toolkit for Windows Phone
If you’ve been developing on Windows Phone 7 for a while, odds are you are a Microsoft Silverlight (or Microsoft XNA) guru. But you probably try to minimize the amount of time that you spend building web services to support your application, or you might find that this type of development is a little out of your comfort zone. You also probably find yourself building and deciding where to host two types of services over and over again: a service to support sending notifications and a service for securing access to your application.
The Windows Azure Toolkit for Windows Phone, also available from the Microsoft DPE Team on CodePlex, makes doing both easy by hosting your solution in Windows Azure. As part of the template-creation process in Visual Studio, the toolkit asks you which kind of notifications you want to support (see Figure 2). You can choose from Windows Phone notifications (which leverage the Microsoft Push Notification Service) and iPhone notifications (which use the Apple Push Notification Service).
In addition, you can select your authentication mechanism as part of project creation. You can use either ASP.NET membership, backed by Windows Azure Tables, or you can use the Windows Azure Access Control Service (see Figure 3) . When you have the basic project ready to go (particularly when using the ASP.NET membership store), the F5 experience gives you a website from which to test registration for and sending of Tile, Toast, and Raw notifications (among other features; see Figure 4). The functionality doesn’t end with this simple website (otherwise the toolkit would be one of those limiting accelerators). The template also creates features for controlling access to or performing CRUD operations against Azure Tables, BLOBs, and queues from Windows Phone 7. The functionalities for notifications and for securing access is exposed as Representational State Transfer (REST) services, making them easy to leverage from your existing Windows Phone 7 projects.
The great thing about both these accelerators is that they help you get productive quickly. And they manage to keep you productive throughout development because they offer a great general-purpose solution to two fundamental Windows Azure development scenarios. Check out the links to each accelerator in the Additional Resources box, for excellent step-by-step instructions and videos on how to download and use these accelerators.