SecurityMode 列舉


決定繫結的安全性設定。Determines the security settings for a binding.

public enum class SecurityMode
public enum SecurityMode
type SecurityMode = 
Public Enum SecurityMode


Message 2

系統會使用 SOAP 訊息安全性來提供安全性。Security is provided using SOAP message security.

None 0

停用安全性。Security is disabled.

Transport 1

安全性可使用安全性傳輸 (例如,HTTPS) 來提供。Security is provided using a secure transport (for example, HTTPS).

TransportWithMessageCredential 3

安全性傳輸 (例如,HTTPS) 提供完整性、機密性和驗證,而 SOAP 訊息安全性會提供用戶端驗證。A secure transport (for example, HTTPS) provides integrity, confidentiality, and authentication while SOAP message security provides client authentication.


下列範例會設定 ModeWSHttpBinding 屬性。The following example sets the Mode property of the WSHttpBinding. 如需更多範例,請參閱 如何:設定安全性模式For more examples, see How to: Set the Security Mode.

WSHttpBinding b = new WSHttpBinding();
b.Security.Mode = SecurityMode.Transport;
Dim b As New WSHttpBinding()
b.Security.Mode = SecurityMode.Transport


ProtectionLevel如果設定為 [無],則會忽略傳輸的任何設定 SecurityModeAny ProtectionLevel settings of a transport are ignored if the SecurityMode is set to None. 如需有關屬性的詳細資訊 ProtectionLevel ,請參閱 瞭解保護層級For more information about the ProtectionLevel property, see Understanding Protection Level.

如需 Windows Communication Foundation (WCF) 安全性以及此屬性如何影響一般安全性功能的詳細資訊,請參閱 保護服務Wcf 安全性程式設計For more information about Windows Communication Foundation (WCF) security and how this property affects general security features, see Securing Services and Programming WCF Security. 如需傳輸模式的詳細資訊,請參閱 傳輸安全性For more information about the transport mode, see Transport Security.

請注意,如果您選擇 [TransportWithMessageCredential],則會忽略在或中設定的值 HttpClientCredentialType TcpClientCredentialTypeNote that if you choose TransportWithMessageCredential, then the value set in HttpClientCredentialType or TcpClientCredentialType is ignored.