Channel Model Overview in WCF

Introductions 

WCF endpoints are the main components, those communicate withe the external world, And this communication was done b using\g a communication stack called channel stack.

Here in this article we will go through the little basics of channel stacks in WCF service programing.

Behind The Scene 

See the image below, which shows a basic diagram of the channel stack and the HTTP stack.
In wcf services when two stacks communicates, then the corresponding layers communicates between them. That is the HTTP layer communicates with the HTTP layer of the other stack and respectively.

Channel Stack


Now, the differences: While the TCP stack was designed to provide an abstraction of the physical network, the channel stack is designed to provide an abstraction of not only how the message is delivered, that is, the transport, but also other features such as what is in the message or what protocol is used for communication, including the transport but much more than that. For example, reliable session binding element is part of the channel stack but is not below the transport or the transport itself.

Messages flow through the communication stack as Message objects. As shown in figure above, the bottom channel is called a transport channel. It is the channel that is responsible for sending and receiving messages to and from other parties.

Each channel implements one or more interfaces known as channel shape interfaces or channel shapes. Those channel shapes provide the communication-oriented methods such as send and receive or request and reply that the channel implements and the user of the channel calls.
The interface is call IChannel, The five channel shapes that extend IChannel are:

  • IInputChannel
  • IOutputChannel
  • IRequestChannel
  • IReplyChannel
  • IDuplexChannel
The channel shapes are patterned after some of the fundamental message exchange patterns supported by existing transport protocols. For example, one-way messaging corresponds to an IInputChannel/IOutputChannel pair, request-reply corresponds to IRequestChannel/IReplyChannel pairs and two-way duplex communications corresponds to IDuplexChannel

Hope, this article gives you some basic idea about channel stacks in WCF.


Happy Coding...

Previous Next

No comments:

Post a Comment