This is a solution to solve a couple of problems presented by Azure. If a web role is deployed it can serve folder based content, but currently there is no way to refresh that content. Thus, that content may be stored outside of the web role (e.g., Azure Storage) to facilitate content updates without the need to publish the web role instance(s) again. However, if you place them into Azure storage and serve them directly it isn't as fast as the web role serving it nor is it as cost effective. The goal of this project was to provide 3 pieces of a whole solution:
  1. stage content to Azure Storage
  2. retrieve content and cache locally in the web role
  3. intercept requests for cached content and serve it from the web role instead of directly from Azure Storage

By structuring the content and serving of that content in this way it will give you the flexibility to update content without publishing the web role again, keep the performance high, and reduce cost as you won't incur a storage transaction fee every time the content is served from the web role.

This is currently a source code only solution that has three projects items in it. Among those project items are:
  • LoadStorage - console app to move files from folder to storage
  • AzureFileCacheWeb - a test web site that contains the code for caching files from Azure Storage to a web role LocalResource and the code for an HttpModule to serve that content that has been cached
  • cloudmigrationtest - Azure Cloud Service Project with the AzureFileCacheWeb mapped to a web role.

You should be able to get these up and running from VS2010 with Dev Fabric and Dev Storage. Once they are running you should be able to extract the pieces for load, retrieving, and serving the content. The hope is to eventually move this into a project item that could be easily added via VS to your projects. Currently, you'll have to tease the parts out manually.

Last edited May 5, 2010 at 6:18 PM by jofultz, version 4