MessageCredentialType 枚举

定义

枚举有效的消息凭据类型。

public enum class MessageCredentialType
public enum MessageCredentialType
type MessageCredentialType = 
Public Enum MessageCredentialType
继承
MessageCredentialType

字段

Certificate 3

指定使用证书进行客户端身份验证。

IssuedToken 4

指定使用已颁发的令牌进行客户端身份验证。

None 0

指定匿名身份验证。

UserName 2

指定使用 UserName 进行客户端身份验证。

Windows 1

指定使用 Windows 进行客户端身份验证。

示例

下面的代码演示如何访问 ClientCredentialType 并将其设置为此枚举的成员。

ServiceHost myServiceHost = new ServiceHost(typeof(CalculatorService));
// Create a binding to use.
WSHttpBinding binding = new WSHttpBinding();
binding.Security.Mode = SecurityMode.Message;
binding.Security.Message.ClientCredentialType =
    MessageCredentialType.Certificate;

// Set the client certificate.
myServiceHost.Credentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.My,
    X509FindType.FindBySubjectName,
    "client.com");
Dim myServiceHost As New ServiceHost(GetType(CalculatorService))
' Create a binding to use.
Dim binding As New WSHttpBinding()
binding.Security.Mode = SecurityMode.Message
binding.Security.Message.ClientCredentialType = _
MessageCredentialType.Certificate

' Set the client certificate.
myServiceHost.Credentials.ClientCertificate.SetCertificate( _
        StoreLocation.CurrentUser, _
        StoreName.My, _
        X509FindType.FindBySubjectName, _
        "client.com")

注解

此枚举用于指定进行身份验证的绑定所需的凭据类型。 它可用于所有标准绑定,但除 BasicHttpBinding(该绑定使用 BasicHttpMessageCredentialType)之外。

适用于