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.
- Describes how a service communicates
- Specifies which protocol to be used
- Specifies the encoding method to format the message contents
- Specifies the security requirements
- Specifies the message exchange format
- Specifies the message session mode
There are different types of bindings available in WCF.
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.
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.
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.
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.
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.
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.
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.
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.
This binding can be used to enable WCF applications to send and receive messages to and from existing MSMQ applications that use COM, native C++ APIs or the types defined in the System.Messaging namespace.