How to add handlers dynamically to request /response pipeline

Topics: Web Api
Dec 2, 2011 at 7:15 AM

What's the best way to add delegating handlers and/or message and operation handlers dynamically, based on some context of the incoming request? For instance, say, if the caller is coming from a specific endpoint, or has specified certain request parameters, only then do I want to add an additional delegating handler or msg/operation handler. So, even if I have a custom factory that returns a custom host, I don't want to add these hooks in during the initialization of the host. Is this possible to do and, if it is, is this recommended (as opposed to statically adding handlers during host init and then having the handlers just ignore the requests they aren't "interested" in)?

 

Thanks,

Priya

Coordinator
Dec 2, 2011 at 5:44 PM

Generally we recommend the later approach of just ignoring requests.

Daniel Roth