NetTcpBinding 构造函数

定义

初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class.

重载

NetTcpBinding()

初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class.

NetTcpBinding(SecurityMode)

用所使用的指定安全类型初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with the type of security used specified.

NetTcpBinding(String)

使用指定配置名称初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with a specified configuration name.

NetTcpBinding(SecurityMode, Boolean)

用所使用的指定安全类型和一个指示是否显式启用安全会话的值来初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with the type of security used specified and with a value that indicates whether reliable sessions are explicitly enabled.

注解

安全行为可通过在构造函数中使用可选的 securityMode 参数进行配置。The security behavior is configurable using the optional securityMode parameter in the constructor. 通过使用可选的 reliableSessionEnabled 参数,可以配置 WS-ReliableMessaging 的用法。The use of WS-ReliableMessaging is configurable using the optional reliableSessionEnabled parameter.

NetTcpBinding()

初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class.

public:
 NetTcpBinding();
public NetTcpBinding ();
Public Sub New ()

示例

此示例演示如何创建 NetTcpBinding 、设置安全模式和传输凭据类型。This example shows how to create a NetTcpBinding, setting the security mode and transport credential type.

NetTcpBinding binding = new NetTcpBinding();
binding.Security.Mode = SecurityMode.Transport;
binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;

注解

默认情况下,传输安全用于保护通信 (也就是说,将的值 SecurityMode 设置为 Transport) 并禁用 () 的可靠会话 Enabled falseBy default, transport security is used to secure communication (that is, the value of SecurityMode is set to Transport) and reliable sessions are disabled (that is Enabled is false).

适用于

NetTcpBinding(SecurityMode)

用所使用的指定安全类型初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with the type of security used specified.

public:
 NetTcpBinding(System::ServiceModel::SecurityMode securityMode);
public NetTcpBinding (System.ServiceModel.SecurityMode securityMode);
new System.ServiceModel.NetTcpBinding : System.ServiceModel.SecurityMode -> System.ServiceModel.NetTcpBinding
Public Sub New (securityMode As SecurityMode)

参数

securityMode
SecurityMode

SecurityMode 值,指定与绑定一起使用的安全类型。The SecurityMode value that specifies the type of security used with the binding.

示例

此示例演示如何 NetTcpBinding 使用安全模式参数创建。This example shows how to create a NetTcpBinding using the security mode parameter.

NetTcpBinding bSecurity = new NetTcpBinding(SecurityMode.Transport);

注解

若要配置安全性,请使用此构造函数。Use this constructor when you want to configure the security. 若要配置安全性并启用可靠会话,请使用 NetTcpBinding.NetTcpBinding(SecurityMode, Boolean)If you want to configure security and enable reliable sessions, use NetTcpBinding.NetTcpBinding(SecurityMode, Boolean).

适用于

NetTcpBinding(String)

使用指定配置名称初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with a specified configuration name.

public:
 NetTcpBinding(System::String ^ configurationName);
public NetTcpBinding (string configurationName);
new System.ServiceModel.NetTcpBinding : string -> System.ServiceModel.NetTcpBinding
Public Sub New (configurationName As String)

参数

configurationName
String

NetTcpBinding 的绑定配置名称。The binding configuration name for the NetTcpBinding.

示例

此示例演示如何 NetTcpBinding 使用 configurationName 参数创建。This example shows how to create a NetTcpBinding using the configurationName parameter.

NetTcpBinding bConfigurationName = new NetTcpBinding("MyConfiguration");

注解

要初始化配置中的绑定设置时使用此构造函数。Use this constructor when you want to initialize the binding settings from configuration.

适用于

NetTcpBinding(SecurityMode, Boolean)

用所使用的指定安全类型和一个指示是否显式启用安全会话的值来初始化 NetTcpBinding 类的新实例。Initializes a new instance of the NetTcpBinding class with the type of security used specified and with a value that indicates whether reliable sessions are explicitly enabled.

public:
 NetTcpBinding(System::ServiceModel::SecurityMode securityMode, bool reliableSessionEnabled);
public NetTcpBinding (System.ServiceModel.SecurityMode securityMode, bool reliableSessionEnabled);
new System.ServiceModel.NetTcpBinding : System.ServiceModel.SecurityMode * bool -> System.ServiceModel.NetTcpBinding
Public Sub New (securityMode As SecurityMode, reliableSessionEnabled As Boolean)

参数

securityMode
SecurityMode

SecurityMode 值,指定与绑定一起使用的安全类型。The SecurityMode value that specifies the type of security used with the binding.

reliableSessionEnabled
Boolean

如果已启用可靠会话,则为 true;否则为 falsetrue if reliable sessions are enabled; otherwise, false.

示例

此示例演示如何 NetTcpBinding 使用 securityModereliableSessionEnabled 参数创建。This example shows how to create a NetTcpBinding using the securityMode and reliableSessionEnabled parameters.

NetTcpBinding bSecurityReliable = new NetTcpBinding(SecurityMode.Transport, true);

注解

要配置安全性并启用可靠会话时使用此构造函数。Use this constructor when you want to configure the security and enable reliable sessions.

适用于