Udostępnij za pośrednictwem


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.

ms731092.Important(en-us,VS.100).gif Note:
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.

ms731092.Important(en-us,VS.100).gif Note:
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.

System-Provided Bindings

The following bindings are shipped 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.

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.

Binding Features

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.

Binding Interoperability Mode of Security (Default) Session (Default) Transactions Duplex

BasicHttpBinding

Basic Profile 1.1

(None), Transport, Message, Mixed

None, (None)

(None)

n/a

WSHttpBinding

WS

None, Transport, (Message), Mixed

(None), Transport, Reliable Session

(None), Yes

n/a

WS2007HttpBinding

WS-Security, WS-Trust, WS-SecureConversation, WS-SecurityPolicy

None, Transport, (Message), Mixed

(None), Transport, Reliable Session

(None), Yes

n/a

WSDualHttpBinding

WS

None, (Message)

(Reliable Session)

(None), Yes

Yes

WSFederationHttpBinding

WS-Federation

None, (Message), Mixed

(None), Reliable Session

(None), Yes

No

WS2007FederationHttpBinding

WS-Federation

None, (Message), Mixed

(None), Reliable Session

(None), Yes

No

NetTcpBinding

.NET

None, (Transport), Message,

Mixed

Reliable Session, (Transport)

(None), Yes

Yes

NetNamedPipeBinding

.NET

None,

(Transport)

None, (Transport)

(None), Yes

Yes

NetMsmqBinding

.NET

None, Message, (Transport), Both

(None)

(None), Yes

No

NetPeerTcpBinding

Peer

None, Message, (Transport), Mixed

(None)

(None)

Yes

MsmqIntegrationBinding

MSMQ

None, (Transport)

(None)

(None), Yes

n/a

The following table explains the features found 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.

  • 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.

Session

Specifies whether this binding supports session contracts.

Transactions

Specifies whether transactions are enabled.

Duplex

Specifies whether duplex contracts are supported. Note this feature requires support for Sessions in the binding.

Streaming

Specifies whether the message streaming is supported.

See Also

Concepts

Endpoint Creation Overview
Using Bindings to Configure Services and Clients

Other Resources

Basic WCF Programming