So then, I've got a number of methods in a a couple of services that I've decorated with a custom attribute.
That attribute uses the ApplyDispatchBehavior
from IOperationBehavior
to attach to the method and the BeforeCall
and AfterCall
methods from IParameterInspector
to do some processing before and after the service method is called.
All is good, well was good...
The problem comes when the the services method needs to return a http status along with the a message. The only way I could find to do that was for the method to throw a WebFaultException<T>
passing in our message and the appropriate http status.
The problem with this is the attached attribute's AfterCall
is never called.
The long and short of it is:
- Is there a way of returning a message and setting the http status without throwing an exception?
- If I do have to throw a
WebFaultException<T>
is there a way my attribute can still get called with the returned message?