Different Types Of Bindings In WCF

I will show in what scenario you should use which binding.
 

What Is Binding In WCF

 
Binding describes how a client is going to communicate to WCF service. Binding is used as per client need. It supports different types of protocol to communicate with client and different types of encoding to transfer the data over the internet. So, basically binding is nothing but it is a way of communication between client and service as per client need.
 
binding in WCF 
 
There are different types of bindings available in WCF.
 

BasicHttpBinding

 
It is useful when you are using ASP.NET Web service based service. It uses WS-basic web services component and uses HTTP as transport protocol and encoding as text or xml. Https is also used with this binding.
 

WSHttpBinding

 
It is more secure, reliable and interoperable as compared to basic http binding. It supports WS-* functionality and distributed transactions with reliable and secure sessions using SOAP security. WSHttpBinding uses both HTTP and HTTPS transport for communication.
 
WSHttpBinding 
 

WSDualHttpBinding

 
It is same as WSHttpBinding rather than it supports duplex service. Duplex is a message pattern that is used by client and service to exchange their message via callback. In this binding reliable sessions are enabled by default.
 

WSFederationHttpBinding

 
Sometimes we need to add federated security service which helps us to implement federation which has the ability to share identities with multiple domains for authentication and authorization. It uses WS-federation protocol.
 

NetTcpBinding

 
It supports TCP as protocol and binary encoding by default. It provides cross machine communication and supports WS-ReliableMessaging by default. It provides more secure transfer and reliable communication.
 

NetNamedPipeBinding

 
It uses NamedPipe protocol to communicate with client with full support of SOAP security and transaction. It also uses WS-ReliableMessaging for secure transfer of data over the network and delivering the data in binary encoding.
 

NetMsmqBinding

 
It is used for queue communication. It means that this binding gives us secure and reliable queued communication for the cross machine environment. Uses MSMQ as transport protocol and provides reliable, robust and distributed application.
 

NetPeerTcpBinding

 
This binding uses secure communication between peer to peer environment when you need. It uses TCP as a protocol for communication. SOAP security and transaction are fully supported by this.
 
NetPeerTcpBinding 
 
Thanks for reading the article. Hope you enjoyed this article.


Similar Articles