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訊息和用戶端搭配使用的安全性類型。
範例
下列範例示範如何使用 securityMode
參數,初始化 WSHttpBinding 類別的新實例。
// 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
。
範例
下列範例示範如何使用 securityMode
和 reliableSessionEnabled
參數,初始化 WSHttpBinding 類別的新實例。
// 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