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.
- Create a new business application using the ‘Silverlight Business Application’ template
- Add a new Project to the solution using the ‘Windows Azure Cloud Service’ template
- In the wizard, select ‘OK’ without adding any roles
- 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.
- For each RIA Services assembly referenced by the Web project, open the Properties window and set Copy Local to True
- 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
- In step 3, add a reference from your Web project to the AspProviders sample library
- 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).
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.