Partager via


RIA and Windows Azure

Earlier this week it was announced that Windows Azure now supports .NET 4. I figured a few of you would want to know how you could write a RIA Services application that ran on the cloud, so I thought I’d put something simple together to get you started. This post covers creating and modifying a RIA business application to run on Windows Azure. I’m assuming you already have some familiarity with Azure, the website, and the tools. If not, a couple great places to start are the official home page and Jim’s blog.

Creating a Business Application for the Cloud

These steps show how to create a business application project targeted at the cloud and ready for local development. Steps 2 and 3 can also be followed to modify a preexisting business application for the cloud.

  1. Create a new business application using the ‘Silverlight Business Application’ template
  2. Add a new Project to the solution using the ‘Windows Azure Cloud Service’ template
    1. In the wizard, select ‘OK’ without adding any roles
  3. From the Cloud Service project ‘Roles’ folder, add a Web Role Project from the solution and select the Web project you want to target at the cloud

 

Preparing a Business Application for Deployment

At this point, you should be able to run the application in the Azure development fabric. To prepare the application to run in the cloud, there are only a couple other updates that must be made.

  1. For each RIA Services assembly referenced by the Web project, open the Properties window and set Copy Local to True
  2. Modify the ASP.NET providers to use Azure Table storage following steps 1 - 4 of Jim’s post on using Sample Windows Azure ASP.NET Providers
  3. In step 3, add a reference from your Web project to the AspProviders sample library
  4. In step 4, you do not need to include the session state provider and should update the profile provider instead
     <profile defaultProvider="TableStorageProfileProvider">
      <properties>
        <add name="FriendlyName"/>
      </properties>

      <providers>
        <clear/>

        <add name="TableStorageProfileProvider"
             type="Microsoft.Samples.ServiceHosting.AspProviders.TableStorageProfileProvider"
             description="Profile provider using table storage"
             applicationName="AspProvidersDemo"
             />
      </providers>
    </profile>

Also in step 4, be sure to update the appSettings to match the values specified on your storage account summary page. When setting the endpoints, you will need to use the https scheme (e.g. https://accountname.table.core.windows.net).

Next Steps

At this point you should be able to deploy your business application. This MSDN topic will help guide you through deploying a cloud service from Visual Studio when you’re ready.

One more thing to consider before deploying is whether you need to migrate your data to Azure. There are plenty of guides out there for this so just look around.

Finally, if you’re interested in Logging and Tracing on Windows Azure, I found this MSDN article by Mike Kelly particularly helpful.

That’s all for this post. In part two I’ll help you get started using RIA with Windows Azure and SQL Azure.

Comments

  • Anonymous
    June 30, 2010
    The comment has been removed

  • Anonymous
    June 30, 2010
    Actually, this looks like it may be an IIS configuration problem. The app runs fine on the Visual Studio Development Server, but when I use the Locall IIS web server, I get the same error as the when trying to run on the development fabric.

  • Anonymous
    June 30, 2010
    Problem solved, it was an IIS configuration problem. I added IIS Metabase and IIS 6 Configuration compatibility and all the Common HTTP Features and now it works!

  • Anonymous
    December 02, 2010
    The comment has been removed

  • Anonymous
    December 02, 2010
     <membership defaultProvider="TableStorageMembershipProvider" userIsOnlineTimeWindow = "20">    <providers>      <clear/>      <add name="TableStorageMembershipProvider" line 22

  • Anonymous
    December 02, 2010
    Can you send me the Web.Config file? Just use the 'Email Blog Author' link and I'll email you back.