WSHttpBinding 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 WSHttpBinding 类的新实例。
重载
WSHttpBinding() |
初始化 WSHttpBinding 类的新实例。 |
WSHttpBinding(SecurityMode) |
通过绑定所使用的指定安全性类型初始化 WSHttpBinding 类的新实例。 |
WSHttpBinding(String) |
使用由配置名称指定的绑定初始化 WSHttpBinding 类的新实例。 |
WSHttpBinding(SecurityMode, Boolean) |
通过绑定所使用的指定安全类型以及一个指示是否启用可靠会话的值来初始化 WSHttpBinding 类的新实例。 |
WSHttpBinding()
初始化 WSHttpBinding 类的新实例。
public:
WSHttpBinding();
public WSHttpBinding ();
Public Sub New ()
示例
下面的示例代码演示如何初始化 WSHttpBinding 类的新实例。
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
适用于
WSHttpBinding(SecurityMode)
通过绑定所使用的指定安全性类型初始化 WSHttpBinding 类的新实例。
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)
参数
- securityMode
- SecurityMode
SecurityMode 的值,该值指定在 SOAP 消息和客户端中使用的安全类型。
示例
下面的示例演示如何使用 WSHttpBinding 参数初始化 securityMode
类的新实例。
// 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
适用于
WSHttpBinding(String)
使用由配置名称指定的绑定初始化 WSHttpBinding 类的新实例。
public:
WSHttpBinding(System::String ^ configName);
public WSHttpBinding (string configName);
new System.ServiceModel.WSHttpBinding : string -> System.ServiceModel.WSHttpBinding
Public Sub New (configName As String)
参数
- configName
- String
WSHttpBindingElement 的绑定配置名称。
例外
找不到名为 configName
的绑定元素。
示例
下面的示例演示如何使用字符串自变量初始化 WSHttpBinding 类的新实例。
// 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")
适用于
WSHttpBinding(SecurityMode, Boolean)
通过绑定所使用的指定安全类型以及一个指示是否启用可靠会话的值来初始化 WSHttpBinding 类的新实例。
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)
参数
- securityMode
- SecurityMode
SecurityMode 的值,该值指定在 SOAP 消息和客户端中使用的安全类型。
- reliableSessionEnabled
- Boolean
如果已启用可靠会话,则为 true
;否则为 false
。
示例
下面的示例演示如何使用 WSHttpBinding 和 securityMode
参数初始化 reliableSessionEnabled
类的新实例。
// 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