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

備註

這個列舉可用來指定驗證繫結時所要使用的認證類型。 除了使用 BasicHttpBindingBasicHttpMessageCredentialType 之外,所有標準繫結都會用到它。

適用於