How to choose right WCF binding?

Binding in WCF defines how clients can connect with your service. The base class for all bindings in WCF is System.ServiceModel.Channels.Binding. A Binding includes definition for WS-* protocols used, the message encoding and the transport protocol.

The available WCF Bindings are

  • wsHttpBinding
  • basicHttpBinding
  • netTcpBinding
  • netNamedPipeBinding
  • netMsmqBinding
  • wsDualHttpBinding

Consider the following scenarios when your are choosing the WCF Binding

  • Consider using wsHttpBinding when you need to support clients over the Internet.
  • Consider using basicHttpBinding when you want to expose your WCF service to legacy clients.
  • Consider using netTcpBinding when you want to support clients over the Intranet.
  • Consider using netNamedPipeBinding when you want to support WCF clients on same machine.
  • Consider using netMsmqBinding when supporting disconnected queued calls.
  • Consider using wsDualHttpBinding when you need to support bi-directional communication between WCF Service and WCF Client.

Custom Binding – You can create custom binding in WCF configuration file and select set of binding elements in order and these elements refer to the transaction, reliable message, security , encoding formats and transport protocol.  

Share this post :

Leave a reply

Why ask?