Redigera

Dela via


WSHttpBinding Constructors

Definition

Initializes a new instance of the WSHttpBinding class.

Overloads

WSHttpBinding()

Initializes a new instance of the WSHttpBinding class.

WSHttpBinding(SecurityMode)

Initializes a new instance of the WSHttpBinding class with a specified type of security used by the binding.

WSHttpBinding(String)

Initializes a new instance of the WSHttpBinding class with a binding specified by its configuration name.

WSHttpBinding(SecurityMode, Boolean)

Initializes a new instance of the WSHttpBinding class with a specified type of security used by the binding and a value that indicates whether a reliable session is enabled.

WSHttpBinding()

Source:
WSHttpBinding.cs

Initializes a new instance of the WSHttpBinding class.

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

Examples

The following sample code shows how to initialize a new instance of the WSHttpBinding class.

WSHttpBinding binding = new WSHttpBinding();
binding.Name = "binding1";
binding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard;
binding.Security.Mode = SecurityMode.Message;
binding.ReliableSession.Enabled = false;
binding.TransactionFlow = false;
Dim binding As New WSHttpBinding()
With binding
    .Name = "binding1"
    .HostNameComparisonMode = HostNameComparisonMode.StrongWildcard
    .Security.Mode = SecurityMode.Message
    .ReliableSession.Enabled = False
    .TransactionFlow = False
End With

Applies to

WSHttpBinding(SecurityMode)

Source:
WSHttpBinding.cs

Initializes a new instance of the WSHttpBinding class with a specified type of security used by the binding.

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

Parameters

securityMode
SecurityMode

The value of SecurityMode that specifies the type of security that is used with the SOAP message and for the client.

Examples

The following example shows how to initialize a new instance of the WSHttpBinding class with a securityMode parameter.

// The security mode is set to Message.
WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message);
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
return binding;
' The security mode is set to Message.
Dim binding As New WSHttpBinding(SecurityMode.Message)
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows
Return binding

Applies to

WSHttpBinding(String)

Initializes a new instance of the WSHttpBinding class with a binding specified by its configuration name.

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

Parameters

configName
String

The binding configuration name for the WSHttpBindingElement.

Exceptions

The binding element with the name configName was not found.

Examples

The following example shows how to initialize a new instance of the WSHttpBinding class with a string argument.

// Set the IssuerBinding to a WSHttpBinding loaded from config
b.Security.Message.IssuerBinding = new WSHttpBinding("Issuer");
' Set the IssuerBinding to a WSHttpBinding loaded from config
b.Security.Message.IssuerBinding = New WSHttpBinding("Issuer")

Applies to

WSHttpBinding(SecurityMode, Boolean)

Source:
WSHttpBinding.cs

Initializes a new instance of the WSHttpBinding class with a specified type of security used by the binding and a value that indicates whether a reliable session is enabled.

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

Parameters

securityMode
SecurityMode

The value of SecurityMode that specifies the type of security that is used with the SOAP message and for the client.

reliableSessionEnabled
Boolean

true if a reliable session is enabled; otherwise, false.

Examples

The following example shows how to initialize a new instance of the WSHttpBinding class with a securityMode and reliableSessionEnabled parameter.

// securityMode is Message
// reliableSessionEnabled is true
WSHttpBinding binding = new WSHttpBinding(SecurityMode.Message, true);
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows;
' securityMode is Message
' reliableSessionEnabled is true
Dim binding As New WSHttpBinding(SecurityMode.Message, True)
binding.Security.Message.ClientCredentialType = MessageCredentialType.Windows

Applies to