1.What is Bindings?
There are multiple aspects of communication with any given service.
There are many possible communication patterns:synchronousely/asynchronousely, bidirectional(双向),durable/volitile...
There are many tranport protocols for the messages, such as HTTP(or HTTPS),TCP,P2P,IPC or MSMQ.
There are a few possible message encoding opitions:you can choose plain text to enable interoperability, binary encoding to optimize performance.
There are a few opitions for securing messages:you can choose not to secure them at all, to provide tranport-level security only, to provide message-level privacy and security,and of cs there are numerous ways for authenticating and authoring the clients.
such as like that. there are many opitions you need to specify when the client consume the services from server.
that's the use of Binding
The Standard Bindings
WCF defines 9 standard bindings:
Basic binding
offered by the BasicHttpBinding class. this is desinged to expose a WCF service as a legacy ASMX web service. so that old clients can work with the new services.
TCP binding
offered by the NetTcpBinding class, this used TCP for cross-machine communication on the intranet. it supports a variety of features, includin reliability, transactions and security. and is optimized for WCF-to-WCF communication. As a result , it requires both the client and service to use WCF.
Peer network binding
offered by the NetPeerTcpBinding class, this uses peer networking as a transport.
IPC binding
offered by the NetNamedPipeBinding class, this used named pipes as a transport for same-machine commucation. it it the most secure binding since it can not accept calls from outside the machine and it supports a variety of features similar to the TCP bindings
Web Service Binding
offered by the WSHttpBinding class, this uses HTTP or HTTPS for tranport, and is designed to offer a variety of features such as reliability, transactions, and security over the internet.
Federated WS binding
offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.
Deplex WS binding
offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional comminication fromm the service to the client.
MSMQ binding
offered by the NetMsmqBinding class, this use MSMQ for transport and is designed to offer support for disconnected queued calls.
MSMQ intergration binding
offered bu the MsMqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.
table 1 Transport and encodin for standard bindings
having a text-based encoding enables a WCF service(or client) to communicate over HTTP with any other service(or client) regardless of its technoligy, Binary encoding over TCP or IPC yields the best performance but at the expense of interoperability, by mandating WCF-to-WCF comminication
the priciple to choose a bingding mechanism