Sunday 31 May 2015

What are WCF bindings and How to choose WCF binding ?

Here In this post I expalined all bindings in WCF. The cinarios where which binding is most suitable and what they supports.


Bindings and Explaination:-

Sl.No
Binding Name
Binding class and Description
1
Basic binding
We use BasicHttpBinding class to implement this binding. It is designed to expose a WCF service as an ASMX web service (asp.net web service), so that old clients (which are still using ASMX web service) can consume new service. By default, it uses Http protocol for transport and encodes the message in UTF - 8 text for-mat. You can also use Https with this binding.
2
Web binding
We use WebHttpBinding class to implements this binding. It is designed to expose WCF services as Http requests by using HTTP-GET, HTTP-POST. It is used with REST based services which may give output as an XML or JSON format. This is very much used with social networks for implementing a syndication feed.
3
Web Service (WS) binding
We use WSHttpBinding class to implement this binding. It is similar to Basic binding and uses Http or Https protocols for transport. But this is designed to offer various WS - * specifications such as WS – Reliable Messaging, WS - Transactions, WS - Security and so on which are not supported by Basic binding.
 wsHttpBinding = basicHttpBinding + WS-* specification
4
WS Dual binding

We use WsDualHttpBinding class to implement this binding. It is similar to wsHttpBinding except it sup-ports bi-directional communication means both clients and services can send and receive messages.
5
TCP binding
We use NetTcpBinding class to implement this binding. It uses TCP protocol to communicate between two machines with in intranet (means same network). It encodes the message in binary format. This is faster and more reliable binding as compared to the Http protocol bindings. It is only used when communication is WCF  to WCF means both client and service should have WCF.
6
IPC binding

We use NetNamedPipeBinding class to implement this binding. It uses named pipe to Communicate between two services on the same machine. This is the most secure and fastest binding among all the bindings.
7
MSMQ binding

We use NetMsmqBinding class to implement this binding. It uses MSMQ for transport and offers sup-port to disconnected message queued. It provides solutions for disconnected scenarios in which service processes the message at a different time than the client send the messages.
8
Federated WS binding
We use WSFederationHttpBinding class to implement this binding. It is a specialized form of WS binding and provides support to federated security.
9
Peer Network binding

We use NetPeerTcpBinding class to implement this binding. It uses TCP protocol but uses peer net-working as transport. In this networking each machine (node) acts as a client and a server to the other nodes. This is used in the file sharing systems like torrent.
10
MSMQ Integration binding
We use MsmqIntegrationBinding class to implement this binding. This binding offers support to communicate with existing systems that communicate via MSMQ.


How to choose binding and which binding is most suitable in wchich cinarios:-




What they supports:-

Sl.No
Binding Name
Message Encoding
Protocol
Security
Transaction
Bi-directional
1
Basic binding
Text
Http, Https
None
-----
------
2
Web Service (WS) binding
Text
Http, Https
Message
Yes
------
3
WS Dual binding
Text
Http, Https
Message
Yes
Yes
4
TCP binding
Binary
TCP
Transport
Yes
Yes
5
IPC binding

Binary
Named pipe
Transport
Yes
Yes
6
MSMQ binding

Binary
MSMQ
Message
Yes
No
7
Federated WS binding
Text
Http, Https
Transport
Yes
No
8
Peer Network binding

Binary
Peer to Peer
Transport
No
Yes
9
MSMQ Integration binding
Not Supported
MSMQ
Transport
Yes
-----



In the above post I explained WCF bindings. Ihope its very useful to you. So please comments your feedback, question regarding this post.

No comments:

Post a Comment