Blocked by the Silverlight ManagedRuntimeError 4004

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.

image

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.

1 Comment

  • Things like this are the reason I am using standard .asmx web services with SilverlightDesktop.net. The other WCF thing that makes me crazy is that your WCF service cannot be on mydomain.com and www.mydomain.com. It will answer on only one address.

    I want to use WCF, I really do. I just need issue like this worked out.

Comments have been disabled for this content.