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