Home > WCF > WCF # 9 – WCF Channels and How WCF Channel stack works?

WCF # 9 – WCF Channels and How WCF Channel stack works?

Hi Geeks,

Today we will see a very important feature/part of the WCF called CHANNELS.

A CHANNEL IS THE CONDUIT through which all messages pass to and from WCF applications.

It is responsible for preparing and delivering messages in a consistent way.

Channels are defined for transports, protocols,and message interception.

Channels are layered together to create a CHANNEL STACK.

The goal of a channel stack is to transform a message into a wire format compatible with the sender and receiver and to transport the message.

There are two types of channels that are used to do this:

1) Transport channels
2) Protocol channels.

 

1) Transport Channels

Transport channels always sit at the bottom of the channel stack and are responsible for transporting messages using a transport protocol. WCF provides a number of transport protocols, including HTTP, TCP, MSMQ, peer-to-peer, and named pipes.

image

2) Protocol Channels

Protocol channels reside on top of transports or other protocol channels. Because protocol
channels reside on top of other channels, they are often referred to as layered channels. Protocol channels are responsible for implementing wire-level protocols by transforming and modifying messages. WCF provides many types of protocol channels. Examples include protocol channels that implement support for security, transactions, and reliable messaging.

How Channel Stack works??

The following diagram shows how a message flows from a WCF client application through a client-side channel stack over a given transport to a server

image

 

I) Role of Protocol Channels

a)At the top of the stack are the protocol channels.                                                         

b)Protocol channels interact with a message and facilitate security, reliable messaging,   transactions, and logging features.

c)There can be any number of protocol channels in a channel stack, depending on the  required features.

II) Role of Transport Channels

a) Transport channels are responsible for sending bytes over a transmission protocol such as TCP or HTTP.

b)They are also responsible for using an encoder to convert messages into an array of bytes for transport.

c)It is the job of an encoder to convert a message from its XML representation to an array of bytes. Encoders are exposed to the transport channel using binding elements.

d)Transport channels look in the binding context for an implementation of a MessageEncoder class. If none are available, the transport channel can specify a default message encoder.

We will go in depth with the Channel Shapes in coming post.

Thank You.

Advertisements
Categories: WCF
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: