Share via


Working with Silverlight RIA Apps in Azure

If you’ve been to my talks lately you might know that I’ve been playing around with Rock Paper Azure (www.RockPaperAzure.com) and using it as the base for some examples to show how to use the Windows Azure tools. One talk shows using the Windows Phone as a client to play the game from, and I wanted to build out some web pages to manage the data using Silverlight and RIA Services.

Simply creating the site took very little time. Start with an Azure Cloud ASP.NET site and add a Silverlight Application. Then add an EF model pointing to my database and create a Domain Service (aka WCF RIA Service) to expose the data. After rebuilding the application you’ll find that from the Silverlight XAML editor you’ll have access to your data sources that map out to whatever tables you added in the Entity Framework. Great. Now let’s deploy.

Deploying a Cloud Solution is straight forward. Since the release of 1.4 of the Azure Tools I’ve been using the Web  Deploy feature to make it easy and fast to redeploy the web site, after configuring things you can right click on the web project and select publish which pushes the bits to the server. Visual Studio even populates most of the fields for you if you use the tool to do the publish of the cloud solution. Everything is running great, I publish my RIA version of the app which I added since my original publish. BOOM. Yellow Screen of pain…turn on custom error messages…

To understand what went wrong I know that since I’m in a development environment on Azure and I configured it to do Web Deploy I also have included the ability to remote desktop to the server and see what’s wrong. I open the INETMGR tool to see the site and browse to the page and find that the reason for the error is that the Domain Services assemblies are missing in the Azure environment. The fix? Open the properties of those assemblies in Visual Studio and set the build action to “Copy Local”. After republishing the web site things work great.

One thing to note…if you are running Visual Studio Ultimate and have Intellitrace enabled for the project there are some conflicts in how Intellitrace and Domain Services work, so you will need to add to the list of excluded modules to include events from to have “Microsoft.ServiceModel.*” in the list (see below).

image