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.

ms730879.Important(en-us,VS.85).gif 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.

ms730879.Important(en-us,VS.85).gif 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

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.

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 that enables organizations that are in a federation to efficiently authenticate and authorize users.

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, multiple machine communication.

MsmqIntegrationBinding

<msmqIntegrationBinding>

A binding that is suitable for cross-machine communication between a WCF application and existing Message Queuing applications.

BasicHttpContextBinding

<basicHttpContextBinding>

A binding that is suitable for communicating with WS-Basic Profile conformant Web services that enables HTTP cookies to be used to exchange context.

NetTcpContextBinding

<netTcpContextBinding>

A secure and optimized binding suitable for cross-machine communication between WCF applications that enables SOAP headers to be used to exchange context.

WebHttpBinding

<webHttpBinding>

A binding used to configure endpoints for WCF Web services that are exposed through HTTP requests instead of SOAP messages.

WSHttpContextBinding

<wsHttpContextBinding>

A secure and interoperable binding that is suitable for non-duplex service contracts that enables SOAP headers to be used to exchange context.

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)

BasicHttpBinding

Basic Profile 1.1

(None), Transport, Message, Mixed

(None)

(None)

n/a

Text, (MTOM)

Yes

(buffered)

WSHttpBinding

WS

Transport, (Message), Mixed

(None), Reliable Session, Security Session

(None), Yes

n/a

(Text), MTOM

No

WSDualHttpBinding

WS

(Message), None

(Reliable Session), Security Session

(None), Yes

Yes

(Text), MTOM

No

WSFederationHttpBinding

WS-Federation

(Message), Mixed, None

(None), Reliable Session, Security Session

(None), Yes

No

(Text), MTOM

No

NetTcpBinding

.NET

(Transport), Message, None, Mixed

(Transport), Reliable Session, Security Session

(None), Yes

Yes

Binary

Yes

(buffered)

NetNamedPipeBinding

.NET

(Transport), None

None, (Transport)

(None), Yes

Yes

Binary

Yes

(buffered)

NetMsmqBinding

.NET

Message, (Transport), None

(None), Transport

None, (Yes)

No

Binary

No

NetPeerTcpBinding

Peer

(Transport)

(None)

(None)

Yes

No

MsmqIntegrationBinding

MSMQ

(Transport)

(None)

None, (Yes)

n/a

n/a

No

BasicHttpContextBinding

Basic Profile 1.1

(None), Transport, Message, Mixed

(None)

(None)

n/a

Text, (MTOM)

Yes

(buffered)

NetTcpContextBinding

.NET

(Transport), Message, None, Mixed

(Transport), Reliable Session, Security Session

(None), Yes

Yes

Binary

Yes

(buffered)

WebHttpBinding

.NET

(None), Transport, TransportCredentialOnly

(None)

(None), No

No

(Text)

No

WSHttpContextBinding

WS

Transport, (Message), Mixed

(None), Reliable Session, Security Session

(None), Yes

n/a

Text, (MTOM)

No

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:

  • None: The SOAP message is not secured and the client is not authenticated.

  • Transport: Security requirements are satisfied at the transport layer.

  • TransportCredentialOnly: Only HTTP-based client authentication is provided.

  • Message: Security requirements are satisfied at the message layer.

  • Mixed: Claims are carried in the message; integrity and confidentiality requirements are satisfied by the transport layer.

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:

  • Text: for example UTF-8.

  • Binary

  • Message Transmission Optimization Mechanism (MTOM): A method for efficiently encoding binary XML elements within the context of a SOAP envelope.

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:

  • Buffered: The request and response messages are both buffered.

  • Streamed: The request and response messages are both streamed. 

  • StreamedRequest: The request message is streamed and the response message is buffered. 

  • StreamedResponse: The request message is buffered and the response message is streamed.

See Also

Concepts

Endpoint Creation Overview
Using Bindings to Configure Services and Clients

Other Resources

Basic WCF Programming