Sample Error piece: Check InnerException for exception details.   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()

This problem manifests for me in the following situation.

  • Silverlight App hosted in a ASPX site
  • The Silverlight app is a data-consumer and requires data via a WCF service also hosted in the ASPX Page

Everything works fantastic when you run it via F5 in VS. Once published to IIS it stops communicating with WCF.

Two problems cause this:

  1. The Silverlight app is defaulting to the http://localhost:25775/servicename.svc
    1. Get rid of the port number as it thinks your trying to communicate across domain http://localhost/servicename.svc
    2. Note this wont work via VS when you change it
  2. If you have that fixed but the silverlight app reverts to being unable to communicate with the WCF service again when called remotely you need to do the following(works for me anyway):
    1. Publish the Website with all pieces, SIlverlight, WCF etc to your IIS publish location
    2. Go back tot he Silverlight App and open your web reference to the service in VS
    3. Change it to point at the newly deployed web service location
    4. Change LocalHost to your server name or what ever your setup is. ie http://MyServer/servicename.svc
    5. Press OK in the configure service and build the silverlight app
    6. Copy the newly compiled .xap file from the clientbin folder
    7. Overwrite the deployed .xap file in the location where you published your service
    8. Open up the silverlight app\Website  from the published location

This should now communicate fine under the http://MyServer/servicename.svc but will not under http://localhost/servicename.svc as it will look for the servername and not localhost

 Ideally it really should figure this out for itself in a perfect world ;-)

Really hope this helps!

The Actual errors

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET4.0C; .NET4.0E; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
Timestamp: Mon, 29 Nov 2010 21:43:41 UTC


Message: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.   at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
   at MyService.GetMyJobsCompletedEventArgs.get_Result()
   at MyService.MainPage.t_GetMyJobsCompleted(Object sender, GetMyJobsCompletedEventArgs e)
   at  MyService.MyClient.OnGetMyJobsCompleted(Object state)

An exception occurred during the operation, making the result invalid.  Check InnerException for exception details.

[ExceptionOccurred]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=System.dll&Key=Async_ExceptionOccurred