ClientCredentials.ClientCertificate 属性

定义

获取一个对象,您可以使用该对象来提供客户端用于通过到服务的验证的 X.509 证书。

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

属性值

X509CertificateInitiatorClientCredential

一个表示客户端证书的 X509CertificateInitiatorClientCredential

示例

下面的代码演示如何使用此属性配置 X.509 证书。

// Create the client with the binding and EndpointAddress.
CalculatorClient calcClient = new CalculatorClient(b, ea);

// Set the client credential value to a valid certificate.
calcClient.ClientCredentials.ClientCertificate.SetCertificate(
    StoreLocation.CurrentUser,
    StoreName.TrustedPeople,
    X509FindType.FindBySubjectName,
    "client.com");
' Create the client with the binding and EndpointAddress.
Dim calcClient As New CalculatorClient(b, ea)

' Set the client credential value to a valid certificate.
calcClient.ClientCredentials.ClientCertificate.SetCertificate(StoreLocation.CurrentUser, StoreName.TrustedPeople, X509FindType.FindBySubjectName, "client.com")

注解

还可以使用客户端应用程序配置文件中的证书>设置此值。<

适用于