FB_init

Thursday, April 23, 2009

My daily Silverlight frustration - I

Problem: When the WCF client tries to call the WCF endpoint, I get an error in the response:

System.ServiceModel.CommunicationException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound ---> System.Net.WebException: The remote server returned an error: NotFound

Context: Trying to have a Silverlight application to call the WCF endpoint. Hosting in IIS7.
Other IIS settings: Anonymous enabled. Anonymous user set to app pool's. WCF client security set to none. On the server side, security set to None. BasicHttpBinding.


Explanation: It appears that "NotFound -> System.Net.WebException" is a generic error thrown by Silverlight regardless of the particular server side error. There can be a number of problems, all of them throw the same error. So when investigating or reading articles/fora on the web, do not assume so fast the solution described applies to your case.

The actual error happened because the web site was calling an assembly in the GAC, but didn't trust it. So I was getting an 'invisible' WS fault with FailedAuthentication.

Solution: set trust level="Full" in web.config (careful: this is only or development. Don't do this in production)

Resolution process:

- The Web Development Helper add-in for IE helped with seeing the actual server response contents, which revealed an HTTP 500 internal error, and a WS fault with "FailedAuthentication" as server response.

- Enabling WCF tracing helped a lot diagnose the server side error.

No comments: