Windows Azure Development
Archive for February, 2009
WPF Windows Azure Log Viewer
Feb 12th
It’s not often I have a post that points to someone else’s post (in fact this could be a first).
Bill Lodin has built a WPF app for reading Windows Azure logs. Following on from my previous post of the online log viewer this new viewer looks really cool and has some basic filter capability. After I saw it, I said “Bill you should blog this” and he did.
Do check it out at http://blogs.itmentors.com/bill/2009/02/10/windows-azure-log-viewer/.
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS
Small Business Starter Kit on Windows Azure
Feb 9th
Whilst looking for a simple asp.net application I could “migrate” to Windows Azure, I stumbled upon the Small Business Starter Kit at the ASP.NET web site – http://www.asp.net/downloads/starter-kits/small-business/.
One of the features of the Small Business Starter Kit is the Provider Model. You can either use an SQL or XML data source. Bingo I thought. An XML data source! All I’d need to do with this is load the XML data from Windows Azure Blob storage instead of the file system and it would be running on Windows Azure!
Here is what I did (I assume you are using Visual Studio Web Developer Express & have the Windows Azure SDK & Tools installed):
- Downloaded the Starter Kit, and created a new Small Business Web Site.
- Created a new Cloud project, with a Web Role.
- Deleted the default.aspx & Web.config from the new web role
- Using windows explorer, copied the files from the web site created in step 1, to the folder for the web role created in step 2.
- Added the newly copied files to the project.
- Right clicked the Web Role project and selected Convert to Web Application (this fixes all the build properties, and creates the missing designer files etc.)
Now you can hit F5, and the site runs in Windows Azure. Magic. Clicking on Items, or People will give you errors, because we are trying to load the xml data from the file system. (Actually the error is because the files aren’t copied as part of the output. We could fix that, but really we want them in blob storage so they can be updated at runtime.)
The next step is to update the XML Provider to read the xml files from Blob storage, rather than the file system. Here are the steps I took:
- Added a reference to the storage client sdk sample.
- Added the required configuration to the servicedefinition.csdef and serviceconfiguration.cscfg files for AccountName, AccountSharedKey and BlobStorageEndpoint.
- Updated the ReadAndValidateXml method in the util.cs class to read from blob storage.
- Copied the xml files into blob storage. For this I used the Powershell provider for Windows Azure storage, which is shipped as source code in the SDK.
Hitting F5 runs the site, and reads the items, people etc. from blob storage.
Here is my serviceconfiguration.cscsf file:
<?xml version="1.0"?>
<ServiceConfiguration serviceName="starterbktest" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="WebRole">
<Instances count="1"/>
<ConfigurationSettings>
<Setting name="AccountName" value="devstoreaccount1" />
<Setting name="AccountSharedKey" value="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" />
<Setting name="BlobStorageEndpoint" value="http://127.0.0.1:10000" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
And here is my changed ReadAndValidateXml method:
public static DataSet ReadAndValidateXml(string xmlFilePath, string schemaFilePath)
{
xmlFilePath = Path.GetFileName(xmlFilePath).ToLower();
schemaFilePath = "schemas\\" + Path.GetFileName(schemaFilePath).ToLower();
DataSet dataSet = null;
BlobStorage store = BlobStorage.Create(StorageAccountInfo.GetDefaultBlobStorageAccountFromConfiguration());
BlobContainer container = store.GetBlobContainer("sbkit");
BlobContents xmlFileBlob = new BlobContents(new MemoryStream());
BlobContents xmlSchemaBlob = new BlobContents(new MemoryStream());
container.GetBlob(xmlFilePath, xmlFileBlob, false);
container.GetBlob(schemaFilePath, xmlSchemaBlob, false);
byte[] ook = xmlFileBlob.AsBytes();
byte[] schemaook = xmlSchemaBlob.AsBytes();
dataSet = new DataSet();
dataSet.ReadXmlSchema(new MemoryStream(schemaook));
dataSet.ReadXml(new MemoryStream(ook), XmlReadMode.IgnoreSchema);
return dataSet;
}
The first few lines rework the paths for the files. The rest is simple Blob storage code to read blobs.
For those with more than enough thiings to do already, here is the source code zip.
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS
Azure Services Training Kit Feb 2009 Update
Feb 6th
I’m pleased to announce we have completed the latest revision of the Azure Services Platform training kit. You can find the training kit here.
The Azure Services Training Kit includes a comprehensive set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Azure Services Platform.
The February release includes the following updates:
- 19 demo scripts that walkthrough several of the services
- 10 presentations covering the entire Azure Services Platform
- 3 additional hands-on labs for Live Services
This technical content covers services including:
- Windows Azure
- .NET Services
- SQL Services
- Live Services
If you want a head start on our Azure platform. This is the kit to get.
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS
