WCF: How do i implement a protocol channel to apply with a custom channel
Consider the following picture representing the WCF channel stack:
alt text http://i.msdn.microsoft.com/ee672186.image001(en-us).jpg
I'm implementing my own channel and for that i already implemented the transport and encoding layer. Now i need to create a "protocol channel" layer where the messages should pass after created in encode layer and before get in th开发者_开发问答e service layer.
I guess i need to create a BindingElement whose implements some interface and then add these bindingElement to my Binding. But all documentation i can find just explains how to implement the transport and encoding layers...
Any help? Thanks
As far as I remember, it's pretty much the same thing, meaning you implement a BindingElement as you mentioned, and override the BuildChannelFactory/BuildChannelListener methods to return the factory/listeners for your custom protocol channel.
The difference is that you'll use BindingContext.BuildInnerChannelFactory() and BuildInnerChannelListener() methods to layer your custom channel factory/listener on top of the ones in lower levers of the stack (like your transport channel).
Does that make sense?
精彩评论