Sriram's WebLog Microsoft solution specialist on web platform, Columbus Ohio

Sriram's WebLog Microsoft solution specialist on web platform, Columbus Ohio

August 2007 - Posts

How to log the unhandled web service exceptions

 Unlike ASP.NET, unhandled web services exception can not be caught in global.asax(Application_Error event). Here is the workaround for that

1.Create a SoapExtension class
2.Add the SoapExtensionTypes element in your web.config file and configure your SoapExtension class.
3.In the overrided ProcessMessage method, check whether SoapMessage.Exception has any value
4.Log the exception details only if the SoapMessageStage is SoapMessageStage.AfterSerialize.
5.Make sure ASP.NET account has enough permission to write the log

More about SoapExtension class from MSDN

http://msdn2.microsoft.com/en-us/library/system.web.services.protocols.soapextension(VS.71).aspx

More Posts