Reputation: 29846
My WCF application uses an IDispatchMessageInspector
for some advanced monitoring - when an error occurs and when no error occurs.
I'm looking for a way to get the exception that occurred in my service when I get to the IDispatchMessageInspector.BeforeSendReply
method since I need to perform a specific action based on the exception type.
I'm not looking for modifying\logging my errors as I already do that with a custom IErrorHandler
.
I thought about adding the exception to the OperationContext
when I'm in the IErrorHandler
and simply reading it when I'm back in the IDispatchMessageInspector
, but I prefer something built in.
Is there any way I can fetch the exception when I'm in the IDispatchMessageInspector.BeforeSendReply
method? Maybe somewhere on the OperationContext?
Upvotes: 3
Views: 631
Reputation: 912
IDispatchMessageInspector
interface allows you to see the messages arriving at an endpoint before they have been dispatched as well as the corresponding response message before it is sent back to the client.
A couple of points to be noticed about the
BeforeSendReply()
method that might be useful:
Upvotes: 0