For my Silverlight 2 prototype business app, I wanted to try capturing JSON data from a WCF service and caching it in isolated storage. I found a nice example by Tim Heuer that I updated to the RTW version. After setting up the WCF service on a VPC running Windows Server 2008, I was able to fill the Silverlight datagrid with remote JSON data. Great!, I thought.
The hassles started when I moved the WCF code to a server out on the real Internet. The same Silverlight app on my workstation now throws a 4004 "ManagedRuntimeError" error on startup.
A quick analysis with Fiddler shows the problem. The first thing Silverlight 2 does is look for clientaccesspolicy.xml in the root of the domain. Then, it looks for crossdomain.xml.
In my local VPC (webservice2008), I control the root of the domain, so there's no problem putting a clientaccesspolicy.xml in the right location. However, at aspspider I'm just a non-paying tenant with a subdirectory called kjopc. If there's no clientaccesspolicy.xml (or one that denies access), I'm blocked.
The moral of the story is to make sure you've got full control over the Web site and domain before you try serving data up to Silverlight 2. Even when you own the domain, check that the hosting provider supports WCF. I use webhost4life.com for a couple of sites. Their low-end ASP.NET 3.5 plan doesn't include WCF.