Monday, June 20, 2011

WCF Binding


Binding will describes how client will communicate with service. There are different protocols available for the WCF to communicate to the Client. You can mention the protocol type based on your requirements.
Binding has several characteristics, including the following:
  • Transport
    Defines the base protocol to be used like HTTP, Named Pipes, TCP, and MSMQ are some type of protocols.
  • Encoding (Optional)
    Three types of encoding are available-Text, Binary, or Message Transmission Optimization Mechanism (MTOM). MTOM is an interoperable message format that allows the effective transmission of attachments or large messages (greater than 64K).
  • Protocol(Optional)
    Defines information to be used in the binding such as Security, transaction or reliable messaging capability

    Bindings and Channel Stacks

    In WCF all the communication details are handled by channel, it is a stack of channel components that all messages pass through during runtime processing. The bottom-most component is the transport channel. This implements the given transport protocol and reads incoming messages off the wire. The transport channel uses a message encoder to read the incoming bytes into a logical Message object for further processing.

    Figure 1: Bindings and Channel Stacks (draw new diagram)
    After that, the message bubbles up through the rest of the channel stack, giving each protocol channel an opportunity to do its processing, until it eventually reaches the top and WCF dispatches the final message to your service implementation. Messages undergo significant transformation along the way.
    It is very difficult for the developer to work directly with channel stack architecture. Because you have to be very careful while ordering the channel stack components, and whether or not they are compatible with one other.
    So WCF provides easy way of achieving this using end point. In end point we will specify address, binding and contract. To know more about end point. Windows Communication Foundation follows the instructions outlined by the binding description to create each channel stack. The binding binds your service implementation to the wire through the channel stack in the middle.

    Types of Binding

    Let us see more detailed on predefined binding


    • It is suitable for communicating with ASP.NET Web services (ASMX)-based services that comfort with WS-Basic Profile conformant Web services.
    • This binding uses HTTP as the transport and text/XML as the default message encoding.
    • Security is disabled by default
    • This binding does not support WS-* functionalities like WS- Addressing, WS-Security, WS-ReliableMessaging
    • It is fairly weak on interoperability.


    • Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts.
    • It offers lot more functionality in the area of interoperability.
    • It supports WS-* functionality and distributed transactions with reliable and secure sessions using SOAP security.
    • It uses HTTP and HTTPS transport for communication.
    • Reliable sessions are disabled by default.


    This binding is same as that of WSHttpBinding, except it supports duplex service. Duplex service is a service which uses duplex message pattern, which allows service to communicate with client via callback.
    In WSDualHttpBinding reliable sessions are enabled by default. It also supports communication via SOAP intermediaries.


    This binding support federated security. It helps implementing federation which is the ability to flow and share identities across multiple enterprises or trust domains for authentication and authorization. It supports WS-Federation protocol.


    This binding provides secure and reliable binding environment for .Net to .Net cross machine communication. By default it creates communication stack using WS-ReliableMessaging protocol for reliability, TCP for message delivery and windows security for message and authentication at run time. It uses TCP protocol and provides support for security, transaction and reliability.


    This binding provides secure and reliable binding environment for on-machine cross process communication. It uses NamedPipe protocol and provides full support for SOAP security, transaction and reliability. By default it creates communication stack with WS-ReliableMessaging for reliability, transport security for transfer security, named pipes for message delivery and binary encoding.


    • This binding provides secure and reliable queued communication for cross-machine environment.
    • Queuing is provided by using MSMQ as transport.
    • It enables for disconnected operations, failure isolation and load leveling


    • This binding provides secure binding for peer-to-peer environment and network applications.
    • It uses TCP protocol for communication
    • It provides full support for SOAP security, transaction and reliability.

No comments:

Post a Comment