Redigera

Dela via


NetTcpBinding Constructors

Definition

Initializes a new instance of the NetTcpBinding class.

Overloads

NetTcpBinding()

Initializes a new instance of the NetTcpBinding class.

NetTcpBinding(SecurityMode)

Initializes a new instance of the NetTcpBinding class with the type of security used specified.

NetTcpBinding(String)

Initializes a new instance of the NetTcpBinding class with a specified configuration name.

NetTcpBinding(SecurityMode, Boolean)

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.

Remarks

The security behavior is configurable using the optional securityMode parameter in the constructor. The use of WS-ReliableMessaging is configurable using the optional reliableSessionEnabled parameter.

NetTcpBinding()

Source:
NetTcpBinding.cs
Source:
NetTcpBinding.cs

Initializes a new instance of the NetTcpBinding class.

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

Examples

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;

Remarks

By 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).

Applies to

NetTcpBinding(SecurityMode)

Source:
NetTcpBinding.cs
Source:
NetTcpBinding.cs

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)

Parameters

securityMode
SecurityMode

The SecurityMode value that specifies the type of security used with the binding.

Examples

This example shows how to create a NetTcpBinding using the security mode parameter.

NetTcpBinding bSecurity = new NetTcpBinding(SecurityMode.Transport);

Remarks

Use this constructor when you want to configure the security. If you want to configure security and enable reliable sessions, use NetTcpBinding.NetTcpBinding(SecurityMode, Boolean).

Applies to

NetTcpBinding(String)

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)

Parameters

configurationName
String

The binding configuration name for the NetTcpBinding.

Examples

This example shows how to create a NetTcpBinding using the configurationName parameter.

NetTcpBinding bConfigurationName = new NetTcpBinding("MyConfiguration");

Remarks

Use this constructor when you want to initialize the binding settings from configuration.

See also

Applies to

NetTcpBinding(SecurityMode, Boolean)

Source:
NetTcpBinding.cs
Source:
NetTcpBinding.cs

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)

Parameters

securityMode
SecurityMode

The SecurityMode value that specifies the type of security used with the binding.

reliableSessionEnabled
Boolean

true if reliable sessions are enabled; otherwise, false.

Examples

This example shows how to create a NetTcpBinding using the securityMode and reliableSessionEnabled parameters.

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

Remarks

Use this constructor when you want to configure the security and enable reliable sessions.

Applies to