ServiceCredentials.ClientCertificate 属性

定义

获取此服务的当前客户端证书身份验证和配置设置。

public:
 property System::ServiceModel::Security::X509CertificateInitiatorServiceCredential ^ ClientCertificate { System::ServiceModel::Security::X509CertificateInitiatorServiceCredential ^ get(); };
public System.ServiceModel.Security.X509CertificateInitiatorServiceCredential ClientCertificate { get; }
member this.ClientCertificate : System.ServiceModel.Security.X509CertificateInitiatorServiceCredential
Public ReadOnly Property ClientCertificate As X509CertificateInitiatorServiceCredential

属性值

X509CertificateInitiatorServiceCredential

一个 X509CertificateInitiatorServiceCredential 实例。

示例

下面的代码演示如何访问此属性,并使用它来设置其他属性。

serviceHost.Credentials.ClientCertificate.Authentication.CertificateValidationMode =
    X509CertificateValidationMode.Custom;
serviceHost.Credentials.ClientCertificate.Authentication.CustomCertificateValidator =
    new MyX509CertificateValidator("CN=Contoso.com");
serviceHost.Credentials.ClientCertificate.Authentication. _
    CertificateValidationMode = X509CertificateValidationMode.Custom
serviceHost.Credentials.ClientCertificate.Authentication. _
   CustomCertificateValidator = New MyX509CertificateValidator("CN=Contoso.com")

注解

您可以使用 Authentication 属性指定一个客户端证书身份验证模式。 在相互证书双工方案中,您可以使用 Certificate 属性指定要在响应或回调中使用的 X.509 证书。

适用于