So what do you do when you deploy the Web service? You need to open up Web.config and edit the /configuration/system.web/customErrors/@mode attribute. By default, this attribute is set to RemoteOnly. The @mode attribute accepts two other values as well:
On
Off
The On setting tells ASP.NET not to add the stack trace information to any Faults. RemoteOnly causes the extra information to show up for clients on the same server and hides the information for remote users. When set to Off, the extra information shows up for all calls to the Web service. This is the same behavior you will see for Web pages. By setting the @mode attribute to On and throwing the same exception, I will get the following Fault instead:
I just set @mode attribute to “Off” while developing. Then when catching exceptions on the client side the exception is filled with method calls, line numbers, stack trace, etc.
Download/order the WeFly247 application from Microsoft. (www.learn247.net)
They have made a quite elegant solution where they use the soap formatter (System.Runtime.Serialization.Formatters.Soap) to serialize and deserialize the exception.
I do not only want to see the exceptions when developing. I need to catch them with a “Application_Error” solution. Application_Error catches allmost all errors. aspx, ashx, master, and even 404 errors when the file does not exist.
I cannot find words for what I think of Microsoft after reading “there really is no good way to generically handle unhandled exception in .NET web services”.
Let us do it the windows way. Just wait for a new version and hope for the best.
My application uses web services over remoting, and the details I add in the xmlNode of the SoapException do not show on the client side.
I resigned myself into sending all error info in one string.
Anyone has an idea of what may be wrong?
Thanks.