What is a WCF Binding? How many different types of bindings available in WCF?


Bindings in WCF actually defines that how to communicate with the service. Binding specifies that what communication protocol as well as encoding method will be used. Optionally, binding can specify other important factors like transactions, reliable sessions and security.

Different types of bindings available

  1. BasicHttpBinding :
    •  It is suitable for communicating with ASP.NET Web services (ASMX)-based services.
    • This binding uses HTTP as the transport and text/XML as the default message encoding.
    • Security is disabled by default.
    • It is fairly weak on interoperability.
  2. WSHttpBinding
    • Defines a secure, reliable, interoperable binding suitable for non-duplex service contracts.
    • It uses HTTP and HTTPS transport for communication.
    • Reliable sessions are disabled by default.
  3. WSDualHttpBinding
    • This binding is same as that of WSHttpBinding, except it supports duplex service.
    • WSDualHttpBinding reliable sessions are enabled by default.
  4. WSFederationHttpBinding
    • This binding is provided by the WSFederationHttpBinding class.
    • It is a specialized form of WS binding and provides support to federated security.
  5. NetTcpBinding
    • This binding provides secure and reliable binding environment for .Net to .Net cross machine communication.
    • It uses TCP protocol for communication be-tween two machines with in intranet.
    • It encodes the message in binary format. This is faster and more reliable binding as compared to the Http protocol bindings.
  6. NetNamedPipeBinding
    • 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.
  7. NetMsmqBinding
    • This binding provides secure and reliable queued communication for cross-machine environment.
    • Queuing is provided by using MSMQ as transport.
  8. NetPeerTcpBinding
    • 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.