In Service oriented architecture there are two parties involved, Server and Client .Server and client communicate to each other via Messages. Message travels over the network. For communication; server and client must be agreed upon

  • Format of message
  • Protocol
  • Transport
  • Encoding of the message etc.

Channels are the responsible component of WCF for

  • Creation of consistent message
  • Transport of consistent message.
  • Conversion of Message in wire format

image

The main goal of Channel is to transform message to format understandable by the communication wire and compatible to both server and client and then transport the message over the wire in between client and server.

image

Essentially Channel has to decide about

  • Protocol used in the message
  • Encoding in the message
  • Message is reliable or not
  • Security of the message
  • Transaction of the message

Mainly channel performs two different types of task and on basis of task channel is of two types,

image

Transport channels are responsible to send and receive the message using a transport protocol. WCF supports HTTP, TCP, and MSMQ, Peer to Peer and Named Piped transport protocols.

Protocol channels are responsible to implement and support security, transaction and reliable messaging. These channels transform and modify the message to make it compatible to wire level.

In a communication there may be one or more than one transport and protocol channels. Collections of different channels are called as Channel Stack.

Different channel performs different tasks. For example one protocol channel can secure the message whereas another protocol channel can make message reliable.

In WCF architecture, transport channel always resides at the bottom of channel stack. A usual channel stack can be depicted as below,

image

WCF provides us many readymade channel stacks to do communication between service and client. This WCF provided channel stacks are known as Binding. One channel layer is defined by one Binding Element.

image

You are very much allowed to create your own channel stack if all WCF provided bindings are not meeting your requirement.

Transport protocol of service and client communicates to each other.

image

Transport channel converts messages into bytes or binary to send over the network. Encoding of messages is also done by the transport channels.

I hope you are having basic idea about channel now. Thanks for reading Smile

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.

Advertisements

9 thoughts on “What is Channel in WCF?

  1. Hi Dhananjay,

    The topics you posted on your site and c-sharpcorner , its Great!!!!!!!!!!!!!!!!!

    Please add me in your friend list and give me your valuable time , if its possible to talk with you on gtalk.

    Awaiting for your replay.

    Regards,
    Asha Bhatt

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