This post is part of a series about WCF extensibility points. For a list of all previous posts and planned future ones, go to the index page.
Before starting on the actual extensibility points for the WCF runtime (first post should be online tomorrow), I decided to write this quick introduction to the runtime itself. Unlike the behaviors, which are invoked when the WCF stack is being created, the runtime extensions are invoked when actual messages are being sent / received by WCF. As could be seen in the usage examples for the behaviors, they were merely used to set up some extension points in the runtime, and those are the ones which did the “real work”.
The majority of the next posts in this series will talk about these runtime extensions. Their interfaces are defined under the System.ServiceModel.Dispatcher namespace, and unlike the behaviors they don’t follow any common pattern – they’re tailored for their specific task. Some of those interfaces apply to both client and server side of communication (parameter inspector, channel initializer, etc.), some apply to the server only (instance provider, dispatch message inspector, etc.), and some to the client only (client message inspector, interactive context initializer, etc.). The interfaces section of the namespace page has a brief description of each one of the interfaces, and their blog entries will have a more detailed description for them.
In many cases (again, as seen in the examples for the behaviors), more than one of those extensions are needed to accomplish a task for a specific scenario. One thing that I didn’t know until a couple of days ago was exactly the order in which each of these extensibility points are called, so I decided to write a simple program, adding hooks to all of the runtime extensibility points to see what would come out. This actually helped me to understand their role in the whole message stack, and it can be used as a simple one-stop place if you’re ever wondering where to add a hook to one of the extensibility points listed in here.
When run, the program will show when each method of the extension interfaces are called. The server ones are written in blue, while the ones from the client side are written in yellow, to make it easier to differentiate where each trace is coming from.
The inspection interfaces, starting with the message inspectors, then the parameter inspectors.
[Code in this post]
[Back to the index]
Carlos Figueira http://blogs.msdn.com/carlosfigueira Twitter: @carlos_figueira http://twitter.com/carlos_figueira