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 ();

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

.NET 8 (package-provided) e altre versioni
Prodotto Versioni
.NET Core 1.0, Core 1.1, 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

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);

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

.NET 8 (package-provided) e altre versioni
Prodotto Versioni
.NET Core 1.0, Core 1.1, 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

NetTcpBinding(String)

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

public NetTcpBinding (string configurationName);

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

.NET Core 1.1 e altre versioni
Prodotto Versioni
.NET Core 1.0, Core 1.1
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
UWP 10.0

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);

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

.NET 8 (package-provided) e altre versioni
Prodotto Versioni
.NET 8 (package-provided)
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)