NetTcpBinding.PortSharingEnabled 属性

定义

获取或设置一个值,该值指示是否为采用此绑定配置的连接启用 TCP 端口共享。Gets or sets a value that indicates whether TCP port sharing is enabled for the connection configured with this binding.

public:
 property bool PortSharingEnabled { bool get(); void set(bool value); };
public bool PortSharingEnabled { get; set; }
member this.PortSharingEnabled : bool with get, set
Public Property PortSharingEnabled As Boolean

属性值

Boolean

如果启用 TCP 端口共享,则为 true;否则为 falsetrue if TCP port sharing is enabled; otherwise, false. 默认值是 falseThe default value is false.

示例

此示例演示如何获取 PortSharingEnabled 值。This example shows how to get the PortSharingEnabled value.

bool portSharingEnabled = binding.PortSharingEnabled;

注解

使用此设置需要通过将 WCF) TCP 端口共享服务的启动类型更改为 "手动" 或 "自动" 来启用 Windows Communication Foundation (WCF。Using this setting requires enabling the Windows Communication Foundation (WCF) TCP Port Sharing Service by changing its startup type to Manual or Automatic.

有关 TCP 侦听器及其启动方式的详细信息,请参阅 TcpListenerFor more information about the TCP Listener and how to start it, see TcpListener.

适用于