ClientCredentials.ClientCertificate 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个对象,您可以使用该对象来提供客户端用于通过到服务的验证的 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。
示例
下面的代码演示如何使用此属性配置 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")
注解
还可以使用客户端应用程序配置文件中的证书>设置此值。<