SecurityMode SecurityMode SecurityMode SecurityMode Enum


确定绑定的安全设置。Determines the security settings for a binding.

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


Message Message Message Message 2

使用 SOAP 消息安全提供安全性。Security is provided using SOAP message security.

None None None None 0

禁用安全性。Security is disabled.

Transport Transport Transport Transport 1

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

TransportWithMessageCredential TransportWithMessageCredential TransportWithMessageCredential 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如果会忽略传输的设置SecurityMode设置为 None。Any 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) 安全和此属性如何影响常规安全功能的详细信息,请参阅Securing Services编程 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,然后中设置的值HttpClientCredentialTypeTcpClientCredentialType将被忽略。Note that if you choose TransportWithMessageCredential, then the value set in HttpClientCredentialType or TcpClientCredentialType is ignored.