How to fix strange errors in silverlight web services

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: http://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 http://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.Net\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.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

Popularity: 7% [?]

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Posterous
  • Tumblr
  • Twitter

Leave a Reply