System-Provided Bindings
Bindings specify the communication mechanism to use when talking to an endpoint and indicate how to connect to an endpoint. A binding contains the following elements:
-
The protocol stack determines the security, reliability, and context flow settings to use for messages that are sent to the endpoint.
-
The transport determines the underlying transport protocol to use when sending messages to the endpoint, for example, TCP or HTTP.
-
The encoding determines 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 criteria for your application, you can create a custom binding. For more information about creating custom bindings, see Custom Bindings.
A secure and interoperable binding that supports the WS-Federation protocol enables organizations that are in a federation to efficiently authenticate and authorize users.
Note:
|
|---|
| Always select a binding that includes security. By default, all bindings except the <basicHttpBinding> element have security enabled. If you do not select a secure binding or disable security, be sure to protect your data in some other manner, such as storing in a secured data center or on an isolated network. |
Note:
|
|---|
| Never use duplex contracts with bindings that do not support security or that have security disabled unless you secure the data by some other means. |
System-Provided Bindings
The following bindings ship with WCF.
| Binding | Configuration Element | Description |
|---|---|---|
|
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. |
||
|
A secure and interoperable binding that is suitable for non-duplex service contracts. |
||
|
A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries. |
||
|
A secure and interoperable binding that supports the WS-Federation protocol that enables organizations that are in a federation to efficiently authenticate and authorize users. |
||
|
<netHttpBinding> |
A binding designed for consuming HTTP or WebSocket services that uses binary encoding by default. |
|
|
<netHttpsBinding> |
A secure binding designed for consuming HTTP or WebSocket services that uses binary encoding by default. |
|
|
A secure and optimized binding suitable for cross-machine communication between WCF applications. |
||
|
A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications. |
||
|
A queued binding that is suitable for cross-machine communication between WCF applications. |
||
|
A binding that enables secure, multiple machine communication. |
||
|
A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing applications. |
||
|
A binding that is suitable for communicating with WS-Basic Profile conformant Web services that enables HTTP cookies to be used to exchange context. |
||
|
A secure and optimized binding suitable for cross-machine communication between WCF applications that enables SOAP headers to be used to exchange context. |
||
|
A binding used to configure endpoints for WCF Web services that are exposed through HTTP requests instead of SOAP messages. |
||
|
A secure and interoperable binding that is suitable for non-duplex service contracts that enables SOAP headers to be used to exchange context. |
||
|
UdpBinding |
<udpBinding> |
A binding to use when sending a burst of simple messages to a large number of clients simultaneously. |
The following table shows the features of each of the system-provided bindings. The bindings are found in the table columns; the features are listed in the rows and described in a second 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.
| Binding | Interoperability | Security (Default) | Session (Default) | Transactions | Duplex | Encoding (Default) | Streaming (Default) | ||
|---|---|---|---|---|---|---|---|---|---|
|
Basic Profile 1.1 |
(None), Transport, Message, Mixed |
(None) |
(None) |
n/a |
Text, (MTOM) |
Yes (buffered) |
|||
|
WS |
Transport, (Message), Mixed |
(None), Reliable Session, Security Session |
(None), Yes |
n/a |
(Text), MTOM |
No |
|||
|
WS |
(Message), None |
(Reliable Session), Security Session |
(None), Yes |
Yes |
(Text), MTOM |
No |
|||
|
WS-Federation |
(Message), Mixed, None |
(None), Reliable Session, Security Session |
(None), Yes |
No |
(Text), MTOM |
No |
|||
|
.NET |
(None), Transport, Message, TransportWithMessageCredential, TransportCredentialOnly |
See note below |
None |
See note below |
(Binary), Text,MTOM |
Yes (buffered) |
|||
|
T:System.ServiceModel.NetHttpsBinding |
.NET |
(Transport), TransportWithMessageCredential |
See note below |
None |
See note below |
(Binary), Text,MTOM |
Yes (buffered) |
||
|
.NET |
(Transport), Message, None, Mixed |
(Transport), Reliable Session, Security Session |
(None), Yes |
Yes |
Binary |
Yes (buffered) |
|||
|
.NET |
(Transport), None |
None, (Transport) |
(None), Yes |
Yes |
Binary |
Yes (buffered) |
|||
|
.NET |
Message, (Transport), None |
(None), Transport |
None, (Yes) |
No |
Binary |
No |
|||
|
Peer |
(Transport) |
(None) |
(None) |
Yes |
|
No |
|||
|
MSMQ |
(Transport) |
(None) |
None, (Yes) |
n/a |
n/a |
No |
|||
|
Basic Profile 1.1 |
(None), Transport, Message, Mixed |
(None) |
(None) |
n/a |
Text, (MTOM) |
Yes (buffered) |
|||
|
.NET |
(Transport), Message, None, Mixed |
(Transport), Reliable Session, Security Session |
(None), Yes |
Yes |
Binary |
Yes (buffered) |
|||
|
WS |
Transport, (Message), Mixed |
(None), Reliable Session, Security Session |
(None), Yes |
n/a |
Text, (MTOM) |
No |
|||
|
UdpBinding |
.NET
|
(None) |
(None) |
(None) |
n/a |
(Text) |
No |
Note:
|
|---|
| NetHttpBinding is a binding designed for consuming HTTP or WebSocket services and uses binary encoding by default. NetHttpBinding will detect whether it is used with a request-reply contract or duplex contract and change its behavior to match - it will use HTTP for request-reply and WebSockets for duplex. This behavior can be overridden using the WebSocketTransportUsage binding setting:Allowed - This is the default value and behaves as described above.NotAllowed - This prevents WebSockets from being used. Attempting to use a duplex contract with this setting will result in an exception.Required - This forces WebSockets to be used even for request-reply contracts. NetHttpBinding supports reliable sessions in both HTTP mode and WebSocket mode. In WebSocket mode sessions are provided by the transport. |
The following table explains the features listed in the previous table.
| Feature | Description |
|---|---|
|
Interoperability Type |
Names the protocol or technology with which the binding ensures interoperation. |
|
Security |
Specifies how the channel is secured:
|
|
Session |
Specifies whether this binding supports session contracts. |
|
Transactions |
Specifies whether transactions are enabled. |
|
Duplex |
Specifies whether duplex contracts are supported. Note that this feature requires support for Sessions in the binding. |
|
Encoding |
Specifies the wire format of the message. Allowable values include:
|
|
Streaming |
Specifies whether streaming is supported for incoming and outgoing messages. Use the TransferMode property on the binding to set the value. The allowable values include:
|
See Also
Concepts
Endpoint Creation OverviewUsing Bindings to Configure Services and Clients
Other Resources
Basic WCF Programming
Build Date:
Note: