WCF Bindings and Types Explained

Datetime:2016-08-23 04:32:27         Topic: WCF          Share        Original >>
Here to See The Original Article!!!

In this article I will discuss about the various WCF bindings and associated behaviours. In one of my article I have discussed how we can create self hosted WCF service  in C# . In that project I have used basicHttpBinding to communicate between client and the host. If you want to know about the WCF proxy class, you can read this article .

Before starting to compare different type of binding, you should be aware of binding itself.

What is a binding?

Please note the below important point about the bindings-

  • Bindings provide the transport mechanism for the service. And it turns helps the message to travel between client and service.
  • Binding decided how the service is going to communicate.
  • Each service endpoint is associated with a binding
  • WCF is a unified programming model. It encapsulates various technologies to perform tasks. Just with changing the configuration files we can simply achieve the ways in which services interact.
  • Each binding has its own characteristics which included transport protocol, message encoding format and other messaging protocols for the communication channel.

WCF Bindings Present in WCF

WCF Bindings can be set declarative in the App.config file or in the .cs file using the class instance. The benefit of the setting the bindings in the app.config is that there is not need to recompile the solution if we want to change it.

Mentioned below are the binding types of WCF –

  • HTTP Bindings
    BasicHttpBinding supports SOAP 1.1
    WSHTTPBinding, WSDualHttpBinding supports SOAP 1.2
    Travel on port 80 and through firewall. They are clear bindings.
    They are not encrypted.
    Interoperable with other platforms.
    HttpBinding is not secure by default while WSHttpBinding is secure
  • TCP Bindings
    Connection Oriented for communication across process and machines
    They are very fast and secure
    Used inside a firewall
    Supports Streaming
    Supports two way interprocess communication both locally and remotely
  • IPC Bindings
    NetNamedPipeBinding is the class
    Fastest bindings
    Limited to single machine
    Both TCP and IPC binding supports binary message encoding.
  • UDP Bindings
    Non reliable but faster than TCP
    Limited to subnet without bridging
  • MSMQ Bindings
    Need to use its own api i.e. System.Messaging api
    Can work disconnected
    Use WCF services that travel through queuing technology

In this article I have discussed WCF bindings and their types. Based on these comparison we can decide on what type of binding we should use for our WCF service.


Put your ads here, just $200 per month.