Configuring System-Provided Bindings

 

Bindings specify the communication mechanism to use when talking to an endpoint and indicate how to connect to an endpoint. Bindings consist of elements that define how the Windows Communication Foundation (WCF) channels are layered up to provide the required communication features. A binding contains three types of elements:

  • Protocol channel binding elements, which determine the security, reliability, context flow settings, or user-defined protocols to use with messages that are sent to the endpoint.

  • Transport channel binding elements, which determine the underlying transport protocol to use when sending messages to the endpoint, for example, TCP or HTTP.

  • Message encoding binding elements, which determine the wire encoding to use for messages that are sent to the endpoint, for example, text/XML, binary, or Message Transmission Optimization Mechanism (MTOM).

This topic presents all of the system-provided Windows Communication Foundation (WCF) bindings. If none of these meets the exact requirements for your application, you can create a binding using the CustomBinding class. For more information about creating custom bindings, see Custom Bindings.

System_CAPS_ICON_important.jpg Important

Select a binding that has security enabled. By default, all bindings, except the BasicHttpBinding binding, have security enabled. If you do not select a secure binding, or if you disable security, be sure your network exchanges are protected in some other manner, such as being in a secured data center or on an isolated network.

System_CAPS_ICON_important.jpg Important

Do not use duplex contracts with bindings that do not support security, or that have security disabled, unless the network exchange is secured by some other means.

The following bindings are shipped with WCF.

BindingConfiguration ElementDescription
BasicHttpBinding<basicHttpBinding>A binding that is suitable for communicating with WS-Basic Profile conformant Web services, for example, ASP.NET Web services (ASMX)-based services. This binding uses HTTP as the transport and text/XML as the default message encoding.
WSHttpBinding<wsHttpBinding>A secure and interoperable binding that is suitable for non-duplex service contracts.
WS2007HttpBinding<ws2007HttpBinding>A secure and interoperable binding that provides support for the correct versions of the Security, ReliableSession, and TransactionFlow binding elements.
WSDualHttpBinding<wsDualHttpBinding>A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
WSFederationHttpBinding<wsFederationHttpBinding>A secure and interoperable binding that supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users.
WS2007FederationHttpBinding<ws2007FederationHttpBinding>A secure and interoperable binding that derives from WS2007HttpBinding and supports federated security.
NetTcpBinding<netTcpBinding>A secure and optimized binding suitable for cross-machine communication between WCF applications.
NetNamedPipeBinding<netNamedPipeBinding>A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.
NetMsmqBinding<netMsmqBinding>A queued binding that is suitable for cross-machine communication between WCF applications.
NetPeerTcpBinding<netPeerTcpBinding>A binding that enables secure, multi-machine communication.
WebHttpBinding<webHttpBinding>A binding used to configure endpoints for WCF Web services that are exposed through HTTP requests instead of SOAP messages.
MsmqIntegrationBinding<msmqIntegrationBinding>A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing (also known as MSMQ) applications.

The next table shows some of the key features each of the system-provided bindings provided. The bindings are listed in the first column and information regarding the features is described in the table. The following table provides a key for the binding abbreviations used. To select a binding, determine which column satisfies all of the row features you need.

BindingInteroperabilityMode of Security (Default)Session

(Default)
TransactionsDuplex
BasicHttpBindingBasic Profile 1.1(None), Transport, Message, MixedNone, (None)(None)n/a
WSHttpBindingWSNone, Transport, (Message), Mixed(None), Transport, Reliable Session(None), Yesn/a
WS2007HttpBindingWS-Security, WS-Trust, WS-SecureConversation, WS-SecurityPolicyNone, Transport, (Message), Mixed(None), Transport, Reliable Session(None), Yesn/a
WSDualHttpBindingWSNone, (Message)(Reliable Session)(None), YesYes
WSFederationHttpBindingWS-FederationNone, (Message), Mixed(None), Reliable Session(None), YesNo
WS2007FederationHttpBindingWS-FederationNone, (Message), Mixed(None), Reliable Session(None), YesNo
NetTcpBinding.NETNone, (Transport), Message,

Mixed
Reliable Session, (Transport)(None), YesYes
tNamedPipeBinding](assetId:///T:System.ServiceModel.NetNamedPipeBinding?qualifyHint=False&autoUpgrade=True).NETNone,

(Transport)
None, (Transport)(None), YesYes
NetMsmqBinding.NETNone, Message, (Transport), Both(None)(None), YesNo
NetPeerTcpBindingPeerNone, Message, (Transport), Mixed(None)(None)Yes
MsmqIntegrationBindingMSMQNone, (Transport)(None)(None), Yesn/a

The following table explains the features found in the previous table.

FeatureDescription
Interoperability TypeNames the protocol or technology with which the binding ensures interoperation.
SecuritySpecifies how the channel is secured:

- None: The SOAP message is not secured and the client is not authenticated.
- Transport: Security requirements are satisfied at the transport layer.
- Message: Security requirements are satisfied at the message layer.
- Mixed: This security mode is known as TransportWithMessageCredentials. It handles credentials at the message level, and integrity and confidentiality requirements are satisfied by the transport layer.
- Both: Both message level and transport level security are used. This ability is unique to the NetMsmqBinding.
SessionSpecifies whether this binding supports session contracts.
TransactionsSpecifies whether transactions are enabled.
DuplexSpecifies whether duplex contracts are supported. Note this feature requires support for Sessions in the binding.
StreamingSpecifies whether the message streaming is supported.

Endpoint Creation Overview
Using Bindings to Configure Services and Clients
Basic WCF Programming

Show: