MessageCredentialType 枚举

定义

枚举有效的消息凭据类型。Enumerates the valid message credential types.

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

字段

Certificate 3

指定使用证书进行客户端身份验证。Specifies client authentication using a certificate.

IssuedToken 4

指定使用已颁发的令牌进行客户端身份验证。Specifies client authentication using an issued token.

None 0

指定匿名身份验证。Specifies anonymous authentication.

UserName 2

指定使用 UserName 进行客户端身份验证。Specifies client authentication using UserName.

Windows 1

指定使用 Windows 进行客户端身份验证。Specifies client authentication using Windows.

示例

下面的代码演示如何访问 ClientCredentialType 并将其设置为此枚举的成员。The following code shows how to access and set ClientCredentialType to a member of this enumeration.

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")

注解

此枚举用于指定进行身份验证的绑定所需的凭据类型。This enumeration is used to specify the credential type required by a binding for authentication. 它可用于所有标准绑定,但除 BasicHttpBinding(该绑定使用 BasicHttpMessageCredentialType)之外。It is used by all standard bindings except the BasicHttpBinding, which uses BasicHttpMessageCredentialType.

适用于