views:

314

answers:

1

I'm using IDispatchMessageInspector to inspect request/response messages in my WCF service and log some data to our logging database. I also have a custom error handler which catches exceptions and transforms them to faults. I'd like to be able to log the exception (if any) in the IDispatchMessageInspector.BeforeSendReply() method but I cannot figure out how to capture exception data. Is there a fault collection of some sort that I should be looking for? I realize I could log the exception in the IErrorHandler.HandleError() method, but I'd like to include the exception details along with the other details that I'm capturing while inspecting the request/response messages. Thanks!

+1  A: 

Here's something I wrote a while ago about this topic. Basically, an exception will cause a fault message to be sent to the client as a reply

tomasr