ServiceCredentials.ClientCertificate 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取此服务的当前客户端证书身份验证和配置设置。
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 实例。
示例
下面的代码演示如何访问此属性,并使用它来设置其他属性。
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 证书。