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?