tags:

views:

158

answers:

2

Is there a lifecycle that WCF requests go through? Specifically I need to be able to intercept and possibly cancel requests made before they get to the method that was invoked.

+3  A: 

You need to implement an IDispatchMessageInspector and inject it in the serivce behavior stack.

use IDispatchMessageInspector.AfterReceiveRequest to accept or reject a request.

see: http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx

and

http://www.codeproject.com/KB/WCF/WCFIPfilter.aspx

Claudiu
+1  A: 

There's also a really good MSDN "Service Station" article by Aaron Skonnard on Extending WCF with custom behaviors which explains in great detail the various extension points in WCF and how to make best use of them.

Marc

marc_s