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. 有关更多示例,请参见[如何:设置安全模式 @ no__t。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


如果将 @no__t 设置为 None,则会忽略传输的任何 ProtectionLevel 设置。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)安全以及此属性如何影响常规安全功能的详细信息,请参阅保护服务编程 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.