System-Provided 互作性绑定支持的 Web 服务协议

Windows Communication Foundation(WCF)旨在与支持被称为 Web 服务规范的一组规范的 Web 服务进行互操作。 为了简化互作性最佳做法的服务配置,WCF 引入了三个可互作的系统提供的绑定:System.ServiceModel.BasicHttpBindingSystem.ServiceModel.WSHttpBindingSystem.ServiceModel.WSDualHttpBinding。 为了与结构化信息标准推进组织(OASIS)标准实现互操作性,WCF 包括一个可互操作的系统提供的绑定:System.ServiceModel.WS2007HttpBinding。 对于元数据发布,WCF 包括两个可互作的系统提供的绑定: <mexHttpBinding><mexHttpsBinding>。 本主题列出了系统提供的互操作绑定所支持的规范。

basicHttpBinding、wsHttpBinding、ws2007HttpBinding 和 wsDualHttpBinding 绑定支持的 Web 服务协议

所有绑定

<basicHttpBinding><wsHttpBinding><ws2007HttpBinding> 支持以下协议。

注释

有关用于发布元数据的绑定的信息,请参阅本主题后面的“System-Provided 元数据绑定”部分。

类别 协议 规范和用法
运输 HTTP 1.1 HTTP 1.1

BasicHttpBindingWSHttpBindingWS2007HttpBinding使用 HTTP 和 HTTPS 传输。
消息传送 MTOM MTOM

basicHttpBindingwsHttpBindingws2007HttpBinding 支持消息传输优化机制(MTOM)。 默认情况下不使用。 若要使用 MTOM,请将 messageEncoding 属性设置为 "Mtom".

示例:

<wsHttpBinding> <binding messageEncoding="Mtom"/> </wsHttpBinding>
元数据 WSDL 1.1 WSDL 1.1

WCF 使用 Web 服务描述语言(WSDL)来描述服务。
元数据 WS-Policy WS-Policy

WCF 使用 WS-Policy 规范和特定于域的断言来描述服务要求和功能。
元数据 WS-Policy 1.5 WS-Policy 1.5

WCF 使用 WS-Policy 规范和特定于域的断言来描述服务要求和功能。
元数据 WS-PolicyAttachment WS-PolicyAttachment

WCF 实现 WS-PolicyAttachment 以在各个范围使用 Web Services 描述语言 (WSDL) 附加策略表达式。
元数据 WS-MetadataExchange WS-MetadataExchange

WCF 实现 WS-MetadataExchange 来检索 XML 架构、WSDL 和 WS-Policy。

basicHttpBinding

类别 协议 规范和用法
消息传送 SOAP 1.1 SOAP 1.1

根据基本配置文件 1.1, basicHttpBinding 该元素实现 SOAP 1.1 消息协议。
安全 WSS SOAP 消息安全性 1.0 WSS SOAP 消息安全性 1.0

根据基本安全配置文件,该 basicHttpBinding 元素实现基于用户名/密码和基于 X.509 的安全的 Web 服务安全 (WSS) SOAP 消息安全性 1.0 规范。

<basicHttpBinding> <binding name="Binding1"> <security mode="TransportWithMessageCredential &#124; "Message" .../> </binding> </basicHttpBinding>
安全 WSS SOAP 消息安全用户名令牌配置文件 1.0 WSS SOAP 消息安全用户名令牌配置文件 1.0

<basicHttpBinding> <binding name="Binding1"> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="Basic"/> </security> </basicHttpBinding>
安全 WSS SOAP 消息安全 X.509 证书令牌配置文件 1.0 WSS SOAP 消息安全 X.509 证书令牌配置文件 1.0

<basicHttpBinding> <security mode="Message"> <message clientCredentialType="Certificate"/> </security> </basicHttpBinding>

wsHttpBinding、ws2007HttpBinding 和 wsDualHttpBinding

类别 协议 规范和用法
消息传送 SOAP 1.2 入门

消息传送框架

附加项(包括 HTTP 绑定)
消息传送 WS-Addressing 2005/08 Web 服务寻址 1.0 - 核心

Web 服务寻址 1.0 - SOAP

wsHttpBinding, ws2007HttpBindingwsDualHttpBinding实施万维网联盟(W3C)WS-Addressing 建议,以启用异步消息传送、消息关联和传输中性寻址机制。

WCF 不支持加密 WS-Addressing 标头,但 WS-* 规范允许这样做。
消息传送 WS-Addressing 1.0 - 元数据 WS-Addressing 1.0 元数据 可以通过在 ServiceMetadata 行为中设置策略版本来启用对此协议的支持 - 当策略版本设置为 1.2(默认值)时,wsdl 描述符合 WS-Addressing wsdl;当策略版本设置为 1.5 时,wsdl 描述符合 ws-addressing 元数据。

WCF 不支持加密 WS-Addressing 标头,但 WS-* 规范允许这样做。
安全 WSS SOAP 消息安全性 1.0 WSS SOAP 消息安全性 1.0

securityMode属性设置为“wsSecurityOverHttp”(默认值)并使用wsSecurity子元素配置参数时使用。

<wsHttpBinding> <binding name="myBinding"> <security mode="Message" .../> </binding> </wsHttpBinding>
安全 WSS SOAP 消息安全 UsernameToken 配置文件 1.1 WSS SOAP 消息安全用户名令牌配置文件 1.0

wsSecurity 元素 authenticationMode 的属性设置为“Username”时使用。

<wsHttpBinding> <binding name="MyBinding"> <security mode="Message> <message clientCredentialType="UserName negotiateServiceCredential="false" establishSecurityContext="false"/> </security> </binding> </wsHttpBinding>
安全 WSS SOAP 消息安全 X.509 证书令牌配置文件 1.1 WSS SOAP 消息安全 X.509 证书令牌配置文件 1.1

用于消息保护,当wsSecurity元素的authenticationMode属性设置为“Username”、“Certificate”或“None”时。 此外,当wsSecurity元素的authenticationMode属性设置为“Certificate”时,请使用它进行客户端身份验证。

<wsHttpBinding> <binding name="MyBinding"> <security mode="Message> <message clientCredentialType="Certificate" negotiateServiceCredential="false" establishSecurityContext="false"/> </security> </binding> </wsHttpBinding>
安全 WSS SOAP 消息安全 Kerberos 令牌配置文件 1.1 WSS SOAP 消息安全 Kerberos 令牌配置文件 1.1

用于身份验证和消息保护,当wsSecurity元素的authenticationMode属性设置为“Windows”时。

<wsHttpBinding> <binding name="MyBinding"> <security mode="Message> <message clientCredentialType="Windows" negotiateServiceCredential="false" establishSecurityContext="false"/> </security> </binding> </wsHttpBinding>
安全 WS-SecureConversation WS-SecureConversation

用于在security/@mode属性设置为“Message”且message/@establishSecurityContext属性设置为“true”(默认值)时提供安全会话。
安全 WS-Trust WS-Trust

由 WS-SecureConversation 使用(参见上面)。
可靠消息传递 WS-ReliableMessaging WS-ReliableMessaging

当绑定配置为使用 reliableSession 时使用。

<wsHttpBinding> <binding name="myBinding"> <reliableSession/> </binding> </wsHttpBinding>
交易 WS-AtomicTransaction WS-AtomicTransaction

用于事务管理器之间的通信。 WCF 客户端和服务始终使用本地事务管理器。
交易 WS-Coordination WS 协调

flowTransactions属性设置为“允许”或“必需”时,用于传递事务上下文。

<wsHttpBinding> <binding transactionFlow="true"/> </wsHttpBinding>

wsFederationHttpBinding 和 ws2007FederationHttpBinding

<引入了 wsFederationHttpBinding><ws2007FederationHttpBinding> 元素,以支持联合方案,其中第三方颁发用于对客户端进行身份验证的令牌。 除了所使用的 wsHttpBinding协议外, wsFederationHttpBinding 还利用:

  • 用于令牌颁布的 WS-Trust

  • 用于已颁发令牌最常见格式的 WSS 安全断言标记语言 (SAML) 令牌配置文件 1.0 和 1.1。

示例:

<wsFederationHttpBinding>
  <binding name="myBinding">
     <security mode="Message">
       <message issuedKeyType="Symmetric"
                issuedTokenType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV1.1">
         <issuerMetadata address =
         'http://localhost/FederationSample/HomeRealmSTS/STS.svc/mex'/>
       </message>
     </security>
  </binding>
</wsFederationHttpBinding>

有关详细信息,请参阅 联合身份验证

系统提供的元数据绑定

下表说明系统提供的可互操作元数据绑定(由 System.ServiceModel.Description.MetadataExchangeBindings 类公开)支持的协议。

mexHttpBinding

<mexHttpBinding> 绑定支持以下协议。 有关使用此绑定的详细信息,请参阅 发布元数据

类别 协议 规范和用法
运输 HTTP 1.1 HTTP 1.1
消息传送 SOAP 1.2 入门

消息传送框架

附加项(包括 HTTP 绑定)
消息传送 WS-Addressing 2005/08 Web 服务寻址 1.0 - 核心

Web 服务寻址 1.0 - SOAP
元数据 WS-MetadataExchange WS-MetadataExchange

WCF 实现 WS-MetadataExchange 来检索 XML 架构、WSDL 和 WS-Policy。

mexHttpsBinding

<mexHttpsBinding> 支持以下协议。 有关使用此绑定的详细信息,请参阅 发布元数据

类别 协议 规范和用法
运输 HTTP 1.1 HTTP 1.1

启用传输安全。
消息传送 SOAP 1.2 入门

消息传送框架

附加项(包括 HTTP 绑定)
消息传送 WS-Addressing 2005/08 Web 服务寻址 1.0 - 核心

Web 服务寻址 1.0 - SOAP
元数据 WS-MetadataExchange WS-MetadataExchange

WCF 实现 WS-MetadataExchange 来检索 XML 架构、WSDL 和 WS-Policy。

另请参阅