David J
David J

Reputation: 743

Is it safe to throw a fault exception from IDispatchMessageInspector.AfterReceiveRequest

I would like to check if it's safe to throw a fault exception in AfterReceiveRequest. I am using a Custom Message Inspector to check for security headers. If the security check fails I throw the exception.

On the surface this appears to work and the fault is returned to the client.

Of course this exception means the target service method is never called and neither is IDispatchMessageInspector.BeforeSendReply.

Is it is safe to interrupt the WCF stack at this point?

Upvotes: 0

Views: 1128

Answers (1)

Tom Kuijsten
Tom Kuijsten

Reputation: 337

According to Microsoft itself it is a valid scenario:

Patterns and practices

Upvotes: 3

Related Questions