• Cloudy in Seattle

    Now available: March CTP of the Windows Azure Tools and SDK


    New release of the Windows Azure SDK and Tools!

    From now on, you only have to download the Windows Azure Tools for Microsoft Visual Studio and the SDK will be installed as part of that package.

    Windows Azure Tools for Microsoft Visual Studio (please give time for propagation or use the direct link to the download)

    In a nutshell, you can now run managed code Full Trust and if you want to give fastCGI applications on Windows Azure a try, you can do that too!

    Please install the following hotfixes:

  • Hotfix: Native Debugging Improvements
  • Hotfix: Support for FastCGI on the Development Fabric
  • What’s new in Windows Azure SDK

    • Support for developing Managed Full Trust applications. It also provides support for Native Code via PInvokes and spawning native processes.
    • Support for developing FastCGI applications, including support for rewrite rules via URL Rewrite Module.
    • Improved support for the integration of development storage with Visual Studio, including enhanced performance and support for SQL Server (only local instance). 

    What’s new in Windows Azure Tools for Visual Studio

    • Combined installer includes the Windows Azure SDK
    • Addressed top customer bugs.
    • Native Code Debugging.
    • Update Notification of future releases.
    • FastCGI template
  • Cloudy in Seattle

    Updates to Windows Azure MVC Cloud Service for MVC RC2


    [For more recent information on using ASP.NET MVC with Windows Azure please see this post.]

    ASP.Net MVC RC2 released a few days back and I've already gotten a number of requests to update the MVC on Windows Azure samples since they were getting a little stale.

    I updated my posts on MVC and I also added more detail to the original "MVC on Windows Azure" post by making it a walkthrough -- hopefully it will be easy for you to duplicate the steps on your projects.

    Also note that we've released a hotfix that will solve stability issues when using MVC with the Windows Azure Tools.

  • Cloudy in Seattle

    Windows Azure Tools session at Mix '09 - Come on down!


    For those of you who are attending Mix '09, it'd be great if you could come check out my tools talk on Windows Azure: https://content.visitmix.com/2009/Speakers/ (click on "Azure")

    MIX09-T81M Using the Windows Azure Tools for Microsoft Visual Studio to Build Cloud Services
    Friday March 20 |9:25 AM-9:45 AM | San Polo 3401
    By: Jim Nakashima  Tags: ASP.NET | Azure
    Come hear how to use the Windows Azure Tools for Visual Studio to more easily create, build, debug, deploy, run and package scalable services on Windows Azure.

    I really hope to see some of you there -- please come by to chat, I'd really like to get some first hand feedback about the Tools and Platform. 

    I should also mention, if you've seen Steve Marx talk, you know not to miss it, if you haven't, definitely check it out:

    MIX09-T09F Building Web Applications with Windows Azure
    Wednesday March 18 |4:00 PM-5:15 PM | San Polo 3504
    By: Steve Marx  Tags: Azure
    Come learn how to use Windows Azure to build a scalable Web application and deploy it to the cloud.

    Other Windows Azure sessions:

    MIX09-T07F Overview of Windows Azure
    Wednesday March 18 |2:15 PM-3:30 PM | San Polo 3504
    By: Manuvir Das  Tags: Azure
    Curious about cloud computing? Come learn how to use Windows Azure to better address key challenges of running Internet-scale applications in the cloud. Also hear about the essential concepts of Windows Azure, including what's new.

    MIX09-T38F See through the Clouds: Introduction to the Azure Services Platform
    Wednesday March 18 |11:30 AM-12:45 PM | San Polo 3504
    By: James Conrad  Tags: Azure
    Come hear how Microsoft is building a new platform for applications, and learn about the key services that compose the platform as well as how to get started. Also hear Microsoft's roadmap for the Azure Services Platform and learn about new features that will be added.

    MIX09-T08F Windows Azure Storage
    Thursday March 19 |10:30 AM-11:45 AM | San Polo 3504
    By: Brad Calder  Tags: Azure
    Come hear about the highly available and massively scalable cloud storage service that is provided by Windows Azure. Learn how to create and access the different types of Windows Azure storage available, including blobs, tables, and queues.

  • Cloudy in Seattle

    Fix available: ASP.Net MVC RC Crash in a Windows Azure Cloud Service Project


    For those of you that have been unfortunate enough to experience the VS crash when using the ASP.Net MVC RC in a Windows Azure Cloud Service project, I have good news!

    The CLR team has distributed a hotfix.  The KB Article number is 963676 and is posted at http://support.microsoft.com/?kbid=963676

    The hotfix isn't specific to the MVC crash, it solves some crashes in the WPF Designer as well.

    You can download the hotfix here: https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0

    • For Vista/Windows Server 2008 32 bit: Use Windows6.0-KB963676-x86.msu
    • For Vista/Windows Server 2008 64 bit: Use Windows6.0-KB963676-x64.msu

    [update 8/27/2010] - This hotfix has been superceded: http://support.microsoft.com/kb/981574/ and unfortunately it appears we no longer host it on Connect so you'll have to contact Microsoft support, see the KB article for more information.

  • Cloudy in Seattle

    Azure Services Platform Webcast Series


    We're really starting to get a solid set of resources out there for Windows Azure developers!

    Not to mention all of the other resources we know about -- I'm sure there even more out there.

    To add to the list, we have some upcoming Webcasts, along with a set of Virtual Labs and Podcasts available.


    Explore the Azure Services Platform, an Internet-scale cloud services platform that provides an operating system and a set of developer services. Participate in a webcast, download a podcast, or step into a virtual lab to see how you can use the Azure Services individually or together, either to build new applications or to extend existing ones. The Azure Services Platform supports popular standards and protocols, including REST and SOAP, and provides a range of functionality to build applications that span from consumer Web to enterprise scenarios. Join us to discover more. 

    MSDN Webcast: Building Cloud Solutions with Microsoft .NET Services and the Azure Services Platform (Level 200)

    Wednesday, February 25, 2009 11:00 A.M.–12:00 P.M. Pacific Time

    MSDN Webcast: geekSpeak: Windows Azure Storage Services with John Croft (Level 200)

    Wednesday, March 25, 2009 12:00 P.M.–1:00 P.M. Pacific Time

  • Cloudy in Seattle

    Windows Azure Series on All About Microsoft


    Probably a little silly for me to re-blog something that Mary-Jo Foley has posted, but I've had fun reading the Red Dog (internal name for Windows Azure) series she started this week. 

    She's doing a post a day for the week.

    Somehow I got missed on the "Who's Who" list, I'll have to get that corrected :)


  • Cloudy in Seattle

    Potential Crash in VS when using the MVC RC on Windows Azure


    I've received some comments as well as have been contacted by a couple of customers about an issue they have been seeing when using the MVC RC in a Windows Azure Cloud Service project in Visual Studio.

    That is, when you are using the project/following the steps from this post or this post.

    The problem is that Visual Studio crashes with a CLR fail fast when doing an operation such as opening or creating a new view using the MVC tools.

    We gave a repro to the CLR team and they indicated that the crash is due to a known issue in the CLR that affects more than just this scenario.

    A patch (from the CLR team) is in the works and I'll post when it becomes available.

    Sorry for the inconvenience.

  • Cloudy in Seattle

    Deploying a Service Package from Cloud Storage


    We recently deployed a new version of the Azure Services Development Portal.  For those of you who have been having intermittent problems with the Portal, those problems should now be gone.

    That said, to me one of the neatest things that has now been enabled is the ability to deploy a Service Package stored in Windows Azure blob storage. 

    If you have a large Service Package, you’ll really enjoy the fact that deployment from the Cloud is much faster than uploading from your local store.

    • You can use some 3rd party tools (like CloudDrive from the SDK or Spaceblock) or write your own tool to upload your Service Package to Blob Storage.  You could even automate the upload as part of your build.
      • When you decide you want to deploy, it will be much faster
    • It is now faster for you to switch between multiple versions of your Service Package.  Upload them all to Blob Storage and deploy from there.
    • You can have one person build and upload the packages and another manage the deployment.


  • Cloudy in Seattle

    Windows Azure How Do I Videos


    We just released 9 of 40 "How Do I" videos on using the Azure Services Platform - right now the videos target Windows Azure, .Net Services, and Live Services. 

    There are 5 videos related to Windows Azure:

    I still recommend my Quick Lap Around the Tools video walkthrough for the Getting Started video though :)

    Hope these are helpful to you.  If they motivate you to download the tools and SDK, as I hope they will, they can be found here:

  • Cloudy in Seattle

    February Update to the Azure Services Training Kit


    The Azure Services Evangelism team just released an update to the Azure Services Training Kit.  This training kit was born out of the hands on labs at PDC '08 and is a useful way to ramp up on the Azure Services Platform.

    The Azure Services Training Kit February update now includes the following content covering Windows Azure, .NET Services, SQL Services, and Live Services:

    • 13 hands-on labs – including 3 new hands-on labs for the Live Framework & Services
    • 19 new demo scripts – These demo scripts are designed to provide detailed walkthroughs of key features so that someone can easily give a demo of a service
    • 10 new scripted presentations – the presentations used for our 3 day training workshops including detailed speaker notes.

    All of this content is available as an installable package on the Microsoft Download Center. You can download it here: http://go.microsoft.com/fwlink/?LinkID=130354

  • Cloudy in Seattle

    Using an Existing ASP.NET Web Application as a Windows Azure Web Role


    [For an expanded walkthrough about using an existing ASP.NET Web Application in a Cloud Service and migrating data to SQL Azure, please see this post: http://blogs.msdn.com/jnak/archive/2010/02/08/migrating-an-existing-asp-net-app-to-run-on-windows-azure.aspx.  Updated info on using MVC with WIndows Azure in this post.] 

    One of the things which I’ve kind of covered with my MVC posts here and here is the steps for taking an existing ASP.Net Web Application project and getting it to run on Windows Azure as the Web Role.

    Based on some of the forum questions I’ve seen, I figured this could use a post on its own.

    I’ll start this off by making a new ASP.Net Web Application – note that there is currently a limitation in that only Web Applications (and not Web Sites) can be associated as Web Roles in the Windows Azure Tools for Visual Studio – if you really need to use a Web Site, you can do so with the Windows Azure SDK.  If you have a Web Site and are willing to convert it to a Web Application, Visual Studio provides a conversion tool.

    File –> New project brings up the new project dialog:


    Where I’ll select an ASP.Net Web Application.  (this works the same for all ASP.Net Web Application types)

    This creates the Web Application project.

    Right-click on the Web Application project and select “Unload project”.


    Then edit the csproj file:


    This will bring up the csproj (same process for VB) file in the XML editor in Visual Studio.  To the top PropertyGroup, you need to add the RoleType element:

    <Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    (. . .)
    <RoleType>Web</RoleType> </PropertyGroup>

    Save the project file (in this case the csproj).

    A note on RoleType – our tools use the RoleType element in the project to filter out projects in the solution that can be associated as either a Web or Worker role.  That is, when you right click on the roles node in the Cloud Service project and select to associate either the Web or Worker Role to a project in the solution – we use this element to give you a list of Web Role or Worker Role projects to choose from.

    Now, create a new blank Cloud Service




    After the Cloud Service project creation completes, in the Solution Explorer, add the Web Application project created above to the solution by right clicking on the solution and selection Add –> Existing Project…


    and selecting the Web Application project.

    Now add a Web role to the Cloud Service by selecting the Web Application.  This is possible because the project property was added to the csproj file.


    Select the Web Application:


    You now have a Cloud Service that has a Web Role that points to the ASP.Net Web Application that was created above.


    One final thing to do is, in the Web Application project, add a reference to the Microsoft.ServiceHosting.ServiceRuntime assembly.


    This assembly contains the Fabric runtime APIs that you can call for logging, configuration and local storage.

    And that’s it – hit F5 and you get debugging with your service running on the Development Fabric.  Publish the Cloud Service and you get a Windows Azure Service Package. 

    If you are using the ASP.Net providers such as membership, role, profile or session state you can use the sample implementations that are in included in the SDK samples that use Cloud Storage.  See this post for more information on how to set those up.

    One of the bigger challenge you will have when trying to run an existing ASP.Net Web Application on Windows Azure is data.

    Windows Azure provides Blob, Queue and Table storage but doesn’t have a SQL Server story yet (nor does the richer SQL Data Services).  This means that you would have to rewrite your data access layer to use one of the Cloud Storage services.

    You will also need to make sure that you don’t have assumptions about the state of the machine you are running on – in the Windows Azure world, your service could easily be moved to a new VM.  Additionally – Windows Azure Cloud Services only run in a modified version of partial trust.  If you make any calls that require Full Trust, those calls won’t work on Windows Azure.

    Finally, the scale model on Windows Azure is to increase instances of both the Web role and Worker role.  In order to make effective use of that model, it is quite likely that you’ll have to rework some of your code.

    That’s the story for the January 2009 CTP.  Keep in mind that we’re looking at how we can improve on this story and make it easier to move existing and new assets to and from Windows Azure. 

    Stay tuned.

  • Cloudy in Seattle

    Adding Files to your Windows Azure Service Package


    When using the Windows Azure Tools for Visual Studio, there are two times that you end up creating a Windows Azure Service Package:

    1. When you build and run on the Development Fabric -- this is a folder based package, extension is csx.  This is used by the Development Fabric.
    2. When you use the "Publish" feature -- this creates a .cspkg file which is a zipped and encrypted version of the csx built in (1).  This is what you upload to the Cloud.

    This post explains how this process works so that you can have better control over what files end up in the package. 

    The first thing to know is that in both cases above, the way the contents of the package is created are the same.  The difference is that in case 2, the package is zipped and encrypted.

    Web Role

    The way the Web Role copies files to the Service Package is by using the internal ASP.Net _CopyWebApplication build target.  This build target copies the build outputs and content files.

    In other words, it doesn't copy all of the files in your project to the Service Package.  It has to either be a build output or a content file. 

    If you want an your file to be copied, you can add it to the project:


    and set the Build Action from "None":


    To "Content". 


    This marks the file as "Content" and will copy the file to your Service package (both when debugging in the DevFabric and "Publish" to the cspkg).

    The other option you have is to keep the Build Action as "None" but set "Copy to Output Directory" to "Copy if Newer" (or "Copy Always").  The difference is that when you set the Build Action to "Content", the file will show up in the root of the Web Role folder, whereas when you set the file to Copy to the Output Directory, it will show up in the bin directory along side your build output.


    One of the side effects of using the Web Application build action is that linked files are not supported.  We're working with the ASP.Net team to get this fixed in the future.

    Worker Role

    A Worker Role does not use the Web Application target that I referred to above and the only option to have extra files copied to the Service Package is to keep the Build Action set to None and set Copy to Output Directory to "Copy if newer".


    For assemblies that you need to have copied to the output directory, you can always add a reference to that assembly, even if you don't need it directly from your Web or Worker roles.  The reference has a property "Copy Local" which defaults to true.

    One exception is if the referenced file is in the GAC and you'll have to set "Copy Local" to true manually.

  • Cloudy in Seattle

    Debugging Silverlight in a Web Role on the Development Fabric


    As part of the announcement of the January 2009 CTP of the Windows Azure Tools was "Added support to debug Silverlight in a Web Role".  I'll go into more detail about that in this post in 2 ways:

    1. Adding Silverlight to a Web Role
    2. Configuring the Silverlight debugger

    Note: Developing Silverlight applications in Visual Studio requires Silverlight Tools.

    We've also found that folks have run into IIS mime type mapping issues with Silverlight, please follow the following instructions if you run into a "Cannot download Silverlight: issue.

    Registering MIME type in development fabric

    To ensure solutions containing Silverlight clients work correctly in the development fabric, please ensure that the MIME type for the Silverlight .xap extension is configured correctly in IIS.

    1.     Open Internet Information Services (IIS) Configuration Manager and select the server to manage (usually the top-level item on the left side)

    2.     Double-click MIME Types on the right side

    3.     Add an entry to map the .xap extension to the application/x-silverlight-app MIME type

    Adding Silverlight to a Web Role

    In order to add Silverlight to a Web, you first need to create a Cloud Service that contains a Web Role.  In Visual Studio, click on File -> New Project and select a "Web Cloud Service".


    This will create the Cloud Service project along with an ASP.Net Web Application project which is associated to the Cloud Service as the Web Role.

    Next we'll add Silverlight, click on the solution in the solution explorer and select Add -> New Project...


    This will bring up the Add New Project dialog again, and this time you'll select Silverlight -> Silverlight Application.


    After selecting that, you will get the following Silverlight project creation dialog:


    Link the Silverlight control on to the Cloud Service Web Role by ensuring that "Link this Silverlight control into an existing Web site" is selected and the "Choose existing Web site:" ComboBox has selected the Web Role that was created when you created the Cloud Service.  (there should only be one Web Application in your solution so this should be the only option)

    Notice how there is a CheckBox to "Enable Silverlight debugging" -- this directly corresponds to the debugger project setting that I talk about later.

    Set the SilverlightApplication1TestPage.aspx as the startup page so that it will be loaded in the web browser when you hit F5.


    Next, to the Page.xaml, between Grid tag, add a button with a Click event handler by the Button tag as shown in the following xaml snippet:

        <Grid x:Name="LayoutRoot" Background="White">
            <Button Click="Button_Click" Margin="100" Content="Click"/>

    Then right click on "Button_Click" and select "Navigate to Event Handler".  This will create the event handler in code behind (if it doesn't exist already) and take you to that location in the source.


    Add a simple message box to the event handler.

    private void Button_Click(object sender, RoutedEventArgs e)
        MessageBox.Show("Hello from Silverlight in a Web Role");

    When you run the app, and click the button, you will now get the message box.


    To show off the Silverlight debugging, you can now add a breakpoint to the code behind:


    When you click the button, you'll hit the breakpoint!  (This didn't work in earlier versions of the tools)

    Configuring the Silverlight debugger

    The reason the breakpoint above was hit was because as part of the Silverlight project creation, the Silverlight debugger was enabled. (remember the CheckBox I pointed out above?)

    If for some reason (say if you were doing Javascript debugging "you cannot debug Silverlight code and JavaScript code at the same time." or you didn't select "Enable Silverlight debugging when you created the Silverlight project) you disabled the Silverlight debugger, you can re-enable it on the Web tab of the Web Application project settings (lower right corner):


  • Cloudy in Seattle

    January 2009 CTP of the Windows Azure Tools and SDK released


    We're excited to announce that we've released an update to the Windows Azure Tools and SDK.

    What's new in the Tools?

    • Addressed top customer bugs.
      • Resolved hang and performance issues on run and debug.
      • Fixed issue with "Publish" of large projects.
      • Fixed issue with "Create Test Tables" when both the web and worker role reference the same assembly
    • Added support to debug Silverlight in a Web Role.
    • Better storage services integration
    • Error messages when there are Service Configuration or Service Definition errors

    What's new in the SDK?

    • Addressed top customer issues
      • Space in user name
      • Development storage may fail with a fatal error if the user name includes a space character.
      • Concurrent GetMessages requests to the Queue service may return the same message.
      • The DevTableGen utility may fail when passed the same assembly name on the command line more than once.
      • Development storage may fail to update or delete entities that contain special characters like these: '- $ & + , : ; = @'.
    • The Windows Azure SDK offers improved support for the integration of development storage with Visual Studio, including enhanced performance.
    • The StorageClient sample includes the following improvements. For more information, see the StorageClient Sample topic in the Windows Azure SDK help file.
      • The StorageClient sample now offers an optional exponential backoff retry policy.
      • The StorageClient sample now supports production endpoints that include the account name.
    • The ASP.Net Providers sample now supports a search syntax similar to the ASP.Net SQL-based providers. For more information, see the ASPProviders Sample topic in the Windows Azure SDK help file.

    I'll be drilling in to some of the details of how we've made things better in this release in future blog posts -- stay tuned!

  • Cloudy in Seattle

    Packaging up Dependencies


    Albert Pascual just posted an interesting article on his experience using Windows Azure.  A good read.

    One thing that stuck out to me was his point about how if you have a reference to an assembly that in turn references other assemblies that are not being pulled in directly to the web role -- those aren't going to be packaged for deployment.

    He even mentions a workaround, which is to directly reference those assemblies and set copy local to true.


    This is something we're going to have to investigate and see what we can do, it'd be really helpful to know what dependencies will be missing before trying it out on the Azure Services Developer Portal.  Stay tuned.

  • Cloudy in Seattle

    Multiple Service Configurations for a Windows Azure Cloud Service


    In the PDC '08 release of the Windows Azure Tools for Microsoft Visual Studio, when you create a new Cloud Service project, that project will contain associations to 0 or 1 web roles and 0 or 1 worker roles.  It will also include a single Service Definition and single Service Configuration files.

    You'll notice that you can't add additional definition or configuration files to the project either.


    This effectively means that you can only have one configuration of your roles and one set of settings.

    Some of the scenarios that we want to open up in the future (sorry, no time frame available) are:

    • Support for configuration settings that would be used locally, on staging and on production
      • That way you don't have to manage multiple files or comment/uncomment sections manually to run against Development Storage locally, a staging storage account when running your Cloud Service on staging and your production storage account when promoting your Cloud Service to production.
    • Support multiple role configurations (i.e. a configuration that contains only a worker role along with a configuration that contains a web and worker role)

    We'd need to think this through and provide an end to end solution that meets your needs both on the development side as well as the deployment/management side.  That is, the solution would involve more than the tools, it would involve the SDK and the Portal as well.

    To that end, if you have feedback that can help us better understand your needs -- please contact me through this blog or on the forum.

    That said, there is a workaround that may be of some use to you today -- that is to have more than one Cloud Service project in your solution.

    In an existing Cloud Service project where you want to support multiple configurations, right click on your solution in Solution Explorer and Add -> New project... -> Blank Cloud Service.  (I am starting with my Simple Table Storage example)


    You will now have 2 Cloud Service projects in your solution where the active project will determine which roles and configuration files will be used:


    In my sample, the new Cloud Service project is named "SimpleTableSampleCloudStorage".  The idea is that the configuration for this Cloud Service will access the Windows Azure Cloud Storage while the existing one access the Development Storage.

    You'll notice that there are no roles in the SimpleTableSampleCloudStorage and that it is the startup project. (it's bolded)

    I right click on the Roles node and select Add -> Web Role project in Solution...


    and then I select the only project listed, SimpleTableSample_WebRole.

    Next, I open up the ServiceDefinition.csdef file and add the configuration settings by adding the following to the <WebRole/> node:

          <Setting name="AccountName"/>
          <Setting name="AccountSharedKey"/>
          <Setting name="TableStorageEndpoint"/>

    I then open up the ServiceConfiguration.cscfg and add the values:

          <!--Windows Azure Storage-->
          <Setting name="AccountName" value="<insert account name>"/>
          <Setting name="AccountSharedKey" value="<insert Access Key>"/>
          <Setting name="TableStorageEndpoint" value="http://table.core.windows.net"/>

    Now, when I run, since SimpleTableSampleCloudStorage is the startup project, I get the Service Configuration contained in that Cloud Project.

    When I make SimpleTableSample the startup project:


    and run again, I get the local development storage settings.

    Note that the Cloud Service you choose to publish from will affect the Service Definition file that is uploaded to Windows Azure. You also need to double check that you are uploading the Service Configuration file you really want -- they'll look the same and only differ by path.

    For an example of how this workaround is used to support different role configurations of the same projects, have a look at the Thumbnails sample in the SDK which contains a Cloud Service project that has both a web role and a worker along with a Cloud Service project that only contains a worker role


    Finally, please understand that this is just a workaround that has its pitfalls (it's still pretty hard to manage and doesn't do anything to solve staging and production configurations) but hopefully some of you will find this helpful until we design and implement a better solution for you.

  • Cloudy in Seattle

    Your Live Mesh in your car


    azurejournal just posted an article, Porsche, Live Mesh and Windows Azure which touches on a cool experience that is enabled through Cloud technologies.

    That kind of thing is exactly what got me excited about the future of the Cloud in the first place and led me to seek out and join the Cloud Computing Tools team.  Can't wait until the next generation of online experiencs becomes a reality.

  • Cloudy in Seattle

    Updated: Walkthrough on Deploying a Cloud Service (on Windows Azure)


    I've updated the walkthrough I wrote on Deploying a Cloud Service on MSDN based on some feedback.  Hopefully it provides more clarity into when you should use the various endpoints (cloudservice.table.core.windows.net versus table.core.windows.net for example) and is a little more concise on some of the terminology.

    It's a quick and useful read for when you first try deploying your Cloud Service to Windows Azure, it'll save you a lot of time and pain.

  • Cloudy in Seattle

    Creating Tables


    A coworker of mine, Steve Marx, recently posted about creating tables only once due to the performance hit you take when you go to create tables that already exist.

    This is a good thing to know and I decided to update my Simple Table Storage sample to follow the pattern that our Personal Web SIte SDK sample uses where on the first request, I create the tables. (same solution as Steve described).

    I actually went back and forth a bit because the goal of the Simple Table Storage sample is to introduce folks to using the Windows Azure Table Storage service and thus I wanted to keep it as simple as possible. 

    I found that the changes are really minor and since even simple sample code has a way of making itself into production, I went ahead and updated the original post and sample code attached to that post.

  • Cloudy in Seattle

    Visual Studio "Publish" of a Large Windows Azure Cloud Service may Fail


    Update: This has been fixed in the January 2009 CTP of the Windows Azure Tools for Microsoft Visual Studio

    Shan McArthur who's been raising a lot of great issues and giving a lot of great feedback on the Windows Azure forum has recently blogged about an issue when using the "Publish" functionality in Visual Studio.

    Hani did some research and found that in our use of types in the System.IO.Packaging namespace, there is a point in which the code switches to using IsolatedStorage (most likely based on memory consumption) and when that happens, we're failing due to the way that the AppDomain we're running in is setup.

    In other words, it doesn't have to do with complex references but ultimately the size of the package being created.

    As indicated in Shan's post, you can workaround the issue by using cspack from the command line.

    We are actively working on the issue.

  • Cloudy in Seattle

    SpaceBlock File Transfer Utility now Supports Windows Azure Blob Storage


    Right on the heels of my post on how to use the CloudDrive sample to access the logs for your service running on Windows Azure, John Spurlock posted a link to SpaceBlock on the Windows Azure forum that now supports Windows Azure Blob Storage.

    This is really cool and actually a much easier way to access logs, just type in your service name and primary access key and away you go:


    Just makes it really easy to view and transfer to and from your blob storage account. 

    I hope we'll see local host Development Storage endpoint support soon. (with pre-populated devstoreaccount1 info already entered)

    ClickOnce install is here.

  • Cloudy in Seattle

    Using the CloudDrive Sample to Access Windows Azure Logs


    On Windows Azure, you can output trace messages when your Roles are running "in the cloud". 

    You write the messages by calling the RoleManager.WriteToLog() API in Microsoft.ServiceHosting.ServiceRuntime. 

    This post will cover how to:

    1. Copy the logs for your service running on Windows Azure to a blob storage container using the Azure Services Developer Portal
    2. Build and install the CloudDrive sample from the Windows Azure SDK
    3. Use the CloudDrive sample to access your Blob Storage Account
    4. Use CloudDrive to copy your logs to a local directory where you can open them

    This post assumes that you have a service running on Windows Azure that makes use of the RoleManager.WriteToLog() API.  If needed, please refer to the Quick Lap around the Windows Azure Tools and Deploying a Service on Windows Azure walkthroughs.

    You also need to install Windows Powershell

    On the project page for your Hosted Service:


    Click on the "Configure..." button.  You will be directed to a page that will allow you to choose which Storage Account (Note: this is the friendly name for the Storage Account, not the account name, this is important later) and specify the container name in Blob Storage where you want the logs to be copied.

    Note that the container name has the same restrictions as DNS names.


    After you click "Copy Logs", you'll get the following message.


    So how do you get the logs from blob storage?  The easiest way is to use the CloudDrive sample in the Windows Azure SDK.

    In the SDK install folder (C:\Program Files\Windows Azure SDK\v1.0 by default), you'll see a zip file (samples.zip), copy this to a writeable (i.e. not in Program Files) location and unzip it. 

    A useful document on using CloudDrive can be found by opening:

    C:\{. . .}\samples\CloudDrive\CloudDriveReadme.mht

    Follow the steps to build and register CloudDrive as a PowerShell provider:

    The usage of CloudDrive requires it to be registered as a PowerShell provider, which puts the appropriate entries into the registry for PowerShell to locate the .dll.

    1. Open an elevated Windows Azure SDK command prompt by right clicking on Start | Programs | Windows Azure SDK (October 2008 CTP) | Windows Azure SDK Command Prompt
    2. Go to the CloudDrive sample folder
    3. Build the CloudDrive using the provided “buildme.cmd” script.
    4. Install/Run CloudDrive using the provided “runme.cmd” from within an elevated command prompt.

    After doing those steps, you can do the following:

    1. cd Blob:
    2. dir

    This will list your blob containers in Development Storage.  Since I've been using the local Blob Storage, you can see that I do in fact get a list of blob containers:


    That's useful but what I want to do is change this sample so that I can read from the Storage Account where my logs have been saved.

    In the C:\{. . .}\samples\CloudDrive\Scripts directory, you'll find a file called MountDrive.ps1. 

    Create your own copy of this file, and modify the account, key, ServiceUrl and DriveName to match the values you got when creating your Storage Account on Windows Azure through the Azure Services Developer Portal. 

    For example, for the storage account I created with service name of "mvcproviderstorage":


    Account mvcproviderstorage
    Key Primary Access Key
    Service Url http://blob.core.windows.net
    DriveName MyStorage (choose what you like)

    The modified file looks like this:

    function MountDrive { Param ( $Account = "<insert storage service name>", $Key = "<insert primary key>", $ServiceUrl="http://blob.core.windows.net", $DriveName="<insert drive name of your choosing>", $ProviderName="BlobDrive") # Power Shell Snapin setup add-pssnapin CloudDriveSnapin -ErrorAction SilentlyContinue # Create the credentials $password = ConvertTo-SecureString -AsPlainText -Force $Key $cred = New-Object -TypeName Management.Automation.PSCredential -ArgumentList $Account, $password # Mount storage service as a drive new-psdrive -psprovider $ProviderName -root $ServiceUrl -name $DriveName -cred $cred -scope global } MountDrive

    Note that you could either pass in the new parameters at the bottom or change the default values and get rid of the parameters in the call to MountDrive.  I chose the latter although you may choose the former so that you can mount more than one drive with the same script.

    Open up a Windows Powershell and do the following:

    1. Run the version of MountDrive.ps1 you created
    2. "cd MyStorage:" (or whatever you called your DriveName followed by a colon)
    3. dir

    You will now see the container that was created by the Azure Services Developer Portal when you chose to "copy logs".

    "cd" to that container and you will see that you will have a subdirectory named WebRole if your service contains a Web Role and a subdirectory named WorkerRole if your service contains a Worker Role.

    Within the WebRole or WorkerRole directories, you will see subdirectories for each one of the role instances.  For example: WebRole_IN_0 and WebRole_IN_1.  The log files will be contained inside those directories split up by 15 minute chunks.

    To copy a log file, do the following (make sure you can write to the destination folder): 

    copy-cd Events_UTC_xyz.xml c:\file.log

    To copy a directory do the following (note the trailing '\'s -- CloudDrive is stricter than normal Power Shell in requiring the trailing slash for directories as files and directories can have the same name)

    copy-cd WebRole\ c:\WebRole\

    You can now open and examine your log files.  (Tip: Internet Explorer shows the logs formatted nicely)

    Technorati ProfileTechnorati Profile
  • Cloudy in Seattle

    ASP.Net MVC on Windows Azure with Providers


    [For more recent information on using ASP.NET MVC with Windows Azure please see this post.]

    Before you get started with ASP.Net MVC and Windows Azure – please install this hotfix.

    Were you wondering why the sample project I got from Phil attached to my post, ASP.Net MVC on Windows Azure, didn't include the sample Windows Azure ASP.Net providers?

    The answer is that we wanted to get something out early that would unblock folks from trying out the MVC on Windows Azure scenario.  That sample solution accomplished that.

    We were also working out a problem we were seeing when using those providers with MVC.  The problem was that we would get a timeout after logging in or creating a new account when running on Windows Azure -- a problem you won't see when running locally against the Development Fabric.

    Luckily, Phil pointed me to a workaround which I've now verified solves this problem. (the fix is now in MVC).

    I tend to get pinged from time to time about issues with RequestURL so I’ll give a pointer to a post to David’s blog that talks about that.

    This post will cover augmenting the existing "MVC on Windows Azure sample" with membership, role and session state providers as well as the workaround that ensures the sample works when you run on Windows Azure.

    It is again important to note that using ASP.Net MVC on Windows Azure is still a preview.

    The sample code that goes along with this code is on the MSDN Code Gallery MVCCloudService and does not include the sample projects from the Windows Azure SDK, please follow the instruction below for adding and referencing them. (when you first load the project it will complain that the sample projects are missing)

    Starting with the sample project attached to my last post, the first thing to do is to add the AspProviders and the StorageClient projects found in the Windows Azure SDK samples to the solution.

    These sample projects are found in the SDK install folder (C:\Program Files\Windows Azure SDK\v1.0 by default), where you'll see a zip file (samples.zip).  Copy this file to a writeable (i.e. not in Program Files) location and unzip it.

    Right click on the Solution node in Solution Explorer -> Add -> Existing Project:


    Navigate to the directory where you unzipped the Windows Azure SDK samples, AspProviders\Lib and select AspProviders.csproj:


    Do the same to add the StorageClient.csproj project from StorageClient\Lib:


    Then add project references to both of those projects by right clicking on the reference node in the CloudService1_WebRole project and selecting "Add Reference...", choosing the Projects Tab, selected both AspProviders and StorageClient projects and hitting "OK".


    Let's now add the Service Definition and Service Configuration settings and values needed to access the Windows Azure Storage Services by by adding the following code to the Service Definition and Service Configuration files found in the Cloud Service project.

    The settings below are setup for the local Development Storage case.

    Note: When switching over to the *.core.windows.net endpoints, you'll have to use the https addresses (i.e. https://blob.core.windows.net) otherwise the providers will throw an exception.  Alternatively you could set allowInsecureRemoteEndpoints to true -- however that is not recommended.

    The definitions in ServiceDefinition.csdef:

        <Setting name="AccountName"/>
        <Setting name="AccountSharedKey"/>
        <Setting name="BlobStorageEndpoint"/>
        <Setting name="QueueStorageEndpoint"/>
        <Setting name="TableStorageEndpoint"/>
        <Setting name="allowInsecureRemoteEndpoints"/>

    The Values in ServiceConfiguration.cscfg:

    <Setting name="AccountName" value="devstoreaccount1"/>
    <Setting name="AccountSharedKey" value="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="/>
    <Setting name="BlobStorageEndpoint" value=""/>
    <Setting name="QueueStorageEndpoint" value = ""/>
    <Setting name="TableStorageEndpoint" value=""/>
    <Setting name="allowInsecureRemoteEndpoints" value=""/>

    The providers also have settings to specify the name of the table for storing membership, role and session related data.  Note that as the comment indicates, the values below are the only values that will work in the Development Storage case. 

    In the MVCWebrole web.config, change <appSettings/> to the following:

        <!-- provider configuration -->
        <!-- When using the local development table storage service only the default values given
         below will work for the tables (Membership, Roles and Sessions) since these are the names
         of the properties on the DataServiceContext class -->
        <add key = "DefaultMembershipTableName" value="Membership"/>
        <add key = "DefaultRoleTableName" value="Roles"/>
        <add key = "DefaultSessionTableName" value="Sessions"/>
        <add key = "DefaultProviderApplicationName" value="MvcCloudService"/>
        <add key = "DefaultSessionContainerName"/>

    The following connection string for SQL can be removed:

    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>

    We'll now add the providers, via the MVCWebRole web.config file (remove the existing SQL Server ones).  First the membership provider:

        <membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow = "20">
            <add name="TableStorageMembershipProvider"
                 description="Membership provider using table storage"

    Role Manager provider:

        <roleManager enabled="true" defaultProvider="TableStorageRoleProvider" cacheRolesInCookie="true" cookieName=".ASPXROLES" cookieTimeout="30"
                     cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration = "true"
                     cookieProtection="All" >
            <add name="TableStorageRoleProvider"
                 description="Role provider using table storage"

    and the session state provider:

        <sessionState mode="Custom" customProvider="TableStorageSessionStateProvider">
            <clear />
            <add name="TableStorageSessionStateProvider"

    You can consult the AspProvidersDemo project in the Windows Azure SDK samples as well. 

    Note: there is also a profile provider which would be added in the same manner.

    Before running, right click on the Cloud Service project node in Solution Explorer and select "Create Test Storage Tables".  (For more information on creating test storage tables, see this article)


    And there you have it – ASP.Net MVC RC2 running on Windows Azure.

  • Cloudy in Seattle

    Reading a Server Side XML File on Windows Azure


    A question that I got at PDC was whether or not you could read an XML file contained in your Web Role when running on Windows Azure as some folks use this for metadata such as a site map.  The short answer is "yes", just as you would any ASP.Net Web Application (using MapPath to get at the file).

    As an example, you could use a DataSet to read an XML file you have in the App_Data folder:

    DataSet games = new DataSet();
    gameView.DataSource = games;

    Where gameView is defined as:

    <asp:GridView ID="gameView" runat="server"/>

    Likewise, you can use an XmlDataSource to do the same thing:

    <asp:XmlDataSource ID="gameSource" DataFile="~/App_Data/VideoGames.xml" runat="server" />
    <asp:GridView ID="gameView2" DataSourceID="gameSource" runat="server" />

    Your XML file can reside in App_Data, or it could be at the root and everything will work as you expect -- I've tried this on the local Development Fabric as well as on Windows Azure to verify.

    That said, if you look at the Windows Azure trust policy you'll see that you can't write to files in App_Data however. 

    If you really have a need to reference a local store, say for caching or something, you can use the RoleManager.GetLocalResource() method.  You do so by setting the <LocalStorage/> tag in the Service Definition file (csdef) found in the Cloud Service project (ccproj)

    <LocalStorage name="tempStorage" sizeInMB="1"/>

    Then in your server side code, you can access that local storage like this:

    ILocalResource locRes = RoleManager.GetLocalResource("tempStorage");

    Where ILocalResource gives you a path where you can read/write files -- just be aware that you can't count on any files you write to always be there as the Fabric could stop your Role Instance and spin it up on a different VM, any kind of state should be stored in Windows Azure storage.

    That is, If you data that is changing, use Blob or Table Storage.  If you have a large amount of static data, and want to cache a subset locally for better performance, you can use Local Storage.

  • Cloudy in Seattle

    Silverlight MediaElement Playing a Video stored in Windows Azure Blob Storage


    There are two things that I want to show in this post:

    1. That you can use Silverlight in a Windows Azure Cloud Service
    2. That you can stream a movie progressively via http (more about that here) from Windows Azure Blob storage

    The code is attached to this blog post.  Note that you will have to add and reference the Common and StorageClient projects that come as samples in the Windows Azure SDK.

    What I did, is start with my Simple Blob Storage Walkthrough and adapted it to be a Video Store instead.


    The top part of the app is really the same as in the Simple Blob Storage Walkthrough where another column was added to the GridView to provide play buttons.

    When you hit play, the Silverlight control sitting underneath the form part of the page uses a MediaElement to play the video.  The video is played directly from its location in blob storage.

    Adding Silverlight

    Starting where the Simple Blob Storage Walkthrough finished off, lets add Silverlight to that project.  (this assumes that you have Silverlight Tools installed.  See here for more information)

    Note that you may have to configure the mime type in IIS for Silverlight -- you'll know if you get a "Could not download Silverlight application"error:

    Registering MIME type in development fabric

    To ensure solutions containing Silverlight clients work correctly in the development fabric, please ensure that the MIME type for the Silverlight .xap extension is configured correctly in IIS.

    1.     Open Internet Information Services (IIS) Configuration Manager and select the server to manage (usually the top-level item on the left side)

    2.     Double-click MIME Types on the right side

    3.     Add an entry to map the .xap extension to the application/x-silverlight-app MIME type

    Right click on the solution node in the Solution Explorer and select Add -> New Project.  Select "Silverlight Application":


    Name the project VideoPlayer.

    Select to "Link this Silverlight control into an existing Web site" and make sure that your Web Role is selected.  For this walkthrough I chose not to add a test page as I want to add the Silverlight control onto the existing page.


    Solution Explorer will now look contain a Silverlight project and will look like this:


    Open up Default.aspx and at the bottom of the page, just after the statusMessage Label you had from the previous walkthrough, add the following snippet to add the Silverlight control onto the page:

            <asp:ScriptManager ID="ScriptManager1" runat="server">
            <div style="height: 100%;">
                <asp:Silverlight ID="Xaml1" runat="server" Source="~/ClientBin/VideoPlayer.xap" MinimumVersion="2.0.30523"
                    Width="100%" Height="100%" />

    You also need to Register the Silverlight assembly otherwise the asp:Silverlight tag will come up as unknown.  You can do this at the top of Default.aspx, right under the "<%@ Page ..." tag:

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DownloadSite_WebRole._Default" %>
    <%@ Register Assembly="System.Web.Silverlight" Namespace="System.Web.UI.SilverlightControls"
        TagPrefix="asp" %>

    You may also have to add a reference to System.Web.Silverlight from your web Role (it can be found on the .Net tab of the add references dialog).

    Open up Page.xaml and change the Background property of the Grid to "Green" so that we can see the control on the aspx page.  Hit "F5" to debug.

    You should get the following:


    Cool!  We have Silverlight!

    Coding up the Silverlight Page

    First we need a MediaElement to play the video.  Open up Page.xaml and add the MediaElement tag to the Grid as follows.  While we're at it, let's set the Width and Height of the Page to be 640 x 480 to make the video a little bigger and remove the Background attribute. 

    Name the MediaElement "mediaPlayer".

    <UserControl x:Class="VideoPlayer.Page"
        Width="640" Height="480">
        <Grid x:Name="LayoutRoot">
            <MediaElement x:Name="mediaPlayer"/>        

    Note: A couple of issues I've been seeing (with the PDC October 2008 CTP) while developing Silverlight applications running on a Windows Azure Web Role: debugging doesn't seem to be working, the xap in the Web Role isn't always updating as expected resulting in a stale Silverlight UI on F5.  For the second problem, I found right clicking on the Silverlight project and hitting "Rebuild" then right clicking on the Web Role and hitting "Rebuild" before hitting F5 resolved the problem.  We're actively investigating both issues.

    We'll just keep things really simple.  When the play button is clicked, we'll use Javascript to call a method on the Silverlight control passing in the URI that contains the video to play.

    Let's add a scriptable method to the Page class in Page.xaml.cs:

    using System.Windows.Browser;
    public partial class Page : UserControl
        {. . .}
        public void Play(string fileUriString)
            if (!string.IsNullOrEmpty(fileUriString))
                Uri fileUri = new Uri(fileUriString);
                mediaPlayer.Source = fileUri;

    If you want to know more about the ScriptableMemberAttribute and how all this works, please see the MSDN article here.

    The second part of making the control scriptable is to register the scriptable object.  That is done in App.xaml.cs in Application_Startup()

    using System.Windows.Browser;
    private void Application_Startup(object sender, StartupEventArgs e)
        Page p = new Page();
        HtmlPage.RegisterScriptableObject("VideoPlayer", p);
        this.RootVisual = p;

    Playing the Video

    In order to play the video, we need to add a "play" button to each row of the GridView.

    Open up Default.aspx and in the Columns for the GridView, add a column at the end for the Play button.  We'll use the <input/> tag for this as we don't want a postback to occur when we click the button (that will re-initialize the Silverlight control)

            <input type="button" value="Play"/>

    To that button, let's hook up an event handler when it gets clicked.  I did this programatically on the RowDataBound method on the fileView GridView control. 

    The reason is that I wanted an easy way to pass the URI for the video to the Silverlight control.  In the RowDataBound event handler, I can get at the URI and pass it along as a parameter. 

    The event handler will be run on the client side in Javascript.

    In Default.aspx.cs in Page_Load(), register to handle the event:

    fileView.RowDataBound += new GridViewRowEventHandler(fileView_RowDataBound);

    Then handle the event by adding the event handler for each of the <input/> buttons that will pass the URI as a parameter.

    void fileView_RowDataBound(object sender, GridViewRowEventArgs e)
        if (e.Row.RowType == DataControlRowType.DataRow)
            FileEntry fe = (FileEntry)e.Row.DataItem;
            e.Row.Cells[3].Attributes.Add("onclick", "onGridViewRowSelected('" + fe.FileUri + "')");

    Finally, back in Default.aspx, we add the Javascript event handler that calls the scriptable method on our Silverlight control:

    <script language="javascript" type="text/javascript">
        function onGridViewRowSelected(fileUri) {
            var control = document.getElementById("Xaml1");

    Hit F5 to give it a try on the Development Fabric/Storage.  Upload a video sample (say from C:\Users\Public\Videos\Sample Videos) and then hit play.

    One final thing to remember is the upload file size limit on the FileUpload control which is discussed in the Simple Blob Storage Walkthrough.  More likely you'll run into here with video files.


  • Page 4 of 9 (202 items) «23456»