Search code examples
c#.netsilverlightweb-servicesasmx

Handling async ASMX web service exceptions


I've developed silverlight client with makes async web services calls to a asmx web service. The problem is, I want to handle exceptions, so far as to be able to tell in the client application whether there was an exception in the webservice (and therefore will be logged local to the webservice) or whether there was a communication problem (i.e. the endpoint for the webservice was wrong).

In testing both types of exceptions in my project I get the same generic exception:

System.ServiceModel.CommunicationException: The remote server returned an error: NotFound.

This exception is amazingly useless when an exception occured in the webservice as it clearly has been found.

Is the presence of this generic error to do with security (not being allowed to see true errors)? It can't be the fact that I don't have debug strings as I'm running on a dev PC.

Either way, my question is, what's the best way to handle async errors in a commercial silverlight application?

Any links or ideas are most welcome! :)

Thanks a lot!

Andy.


Solution

  • Yes, the generic error deals with security. The idea being that if an attacker does find a fault in the page etc. The person doesn't know what the cause of the error was.

    Have you turned on remote debugging in the serviceDebug tag?

    http://www.mostlydevelopers.com/mostlydevelopers/blog/post/2009/01/14/Debugging-Tips-ndash3b-The-remote-server-returned-an-error-NotFound.aspx

    This should return a less general error.