How to fix strange errors in silverlight web services

by Steve French in ASP.net, How To Fix, Silverlight on March 2, 2010

fix you_smallThe Problem: You upload your wonderful Silverlight application to a new server and begin to get all sorts of strange errors, most notably something like this

Message: Unhandled Error in Silverlight 2 Application An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at StronicoMain.ServerUtil.AddressTypeListCompletedEventArgs.get_Result()
at StronicoMain.Page.proxy_AddressTypeListCompleted(Object sender, AddressTypeListCompletedEventArgs e)
at StronicoMain.ServerUtil.ServerUtilClient.OnAddressTypeListCompleted(Object state)
Line: 1
Char: 1
Code: 0
URI: https://www.servername.com/Silverlight.js

You spend an hour or so trying to decifer the InnerException, which gives you no useful information.  You then try to access the web service via a web browser, like https://www.servername.com/MyService.svc, and you get a 404 error.  You then add that to the mime type list and still the problem is not fixed.

The Cause: Your WCF services are not mapping properly to the IIS 7 metabase.

The Solution: Run the following command “%Windir%Microsoft.NetFrameworkv3.0Windows Communication FoundationServiceModelReg.exe -r” in a command prompt.  That clears everything up.  Please see this page on social.msdn.microsoft.com for more information.

Creative Commons Licensephoto credit: ⓙanet

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog