<tcpTransport>

定义通道用于传输自定义绑定消息的 TCP 传输。

架构层次结构

<system.serviceModel>
  <bindings>
    <customBinding>
      <binding>
        <tcpTransport>

语法

<tcpTransport 
    listenBacklog="Integer"
        portSharingEnabled="Boolean"
    teredoEnabled="Boolean"
    transferMode=”Buffered/Streamed” 
        <connectionPoolSettings
          groupName=”String” 
        idleTimeout"TimeSpan"
        leaseTimeout="TimeSpan"
        maxOutboundConnectionsPerEndpopint=”Integer” />
/>

属性和元素

以下几节描述了特性、子元素和父元素。

属性

特性 说明

listenBacklog

一个正整数,指定侦听器上正等待接受的最大通道数。超出此限制的连接需要排队,直到连接数低于限制值。connectionLeaseTimeout 属性限制客户端在引发连接异常之前将等待连接的持续时间。默认值为 10。

portSharingEnabled

一个布尔值,指定是否为此连接启用 TCP 端口共享。如果此值为 false,则每个绑定都将使用自己的独占端口。默认值为 false

此设置只与服务相关。客户端并不会受影响。

使用此设置要求通过将 Windows Communication Foundation (WCF) TCP 端口共享服务的“启动类型”设置为“手动”或“自动”来启用该服务。

teredoEnabled

一个布尔值,指定是否启用 Teredo(一种用于对防火墙后的客户端进行寻址的技术)。默认值为 false

此属性为基础 TCP 套接字启用 Teredo。有关更多信息,请参见 Teredo Overview(Teredo 概述)。

此属性仅适用于 Windows XP SP2 和 Windows Server 2003。Windows Vista 具有针对 Teredo 的计算机范围的配置选项,因此在运行 Vista 时将忽略此属性。Teredo 要求客户端和服务计算机都安装 Microsoft IPv6 堆栈,并进行正确的配置以便使用 Teredo。有关配置 Teredo 的更多信息,请参见 Teredo Overview(Teredo 概述)。有关更多信息,请参见 Windows Server 2003 技术中心(可能为英文网页)。

子元素

父元素

元素 说明

<binding>

定义自定义绑定的所有绑定功能。

备注

此传输使用“net.tcp://hostname:port/path”形式的 URI。其他 URI 组件是可选的。

tcpTransport 元素是创建实现 TCP 传输协议的自定义绑定的起始点。针对 WCF 到 WCF 的通信对此传输进行了优化。

另请参见

参考

<customBinding>
TcpTransportElement
TcpTransportBindingElement
TransportBindingElement
CustomBinding

其他资源

Transports in Windows Communication Foundation
Choosing a Transport
Windows Communication Foundation Bindings
Extending Bindings
Custom Bindings