views:

320

answers:

2

Hi,

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.

A: 

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.

Kevin
Ahh, thought so, thanks for the link, but this seems to be dealing wiht WCF services, not plain ol' asmx (ones with the [WebMethod] atttribute). Not sure it it would work!
Andy
A: 

I think you may actually be getting a 404 error here. If there were an exception in the service but includeDetailsInException were set to false, then you'd get a FaultException with nothing but the Exception.Message.

I think you need to go look on the machine the service is running on to see if there were any errors or warnings at around the time your client received the exception. In particular, if the service is running on .NET 2.0 or above, then the default configuration of ASP.NET Health Monitoring will log a warning message to the Application event log when an unhandled exception occurs.

John Saunders