X509ServiceCertificateAuthentication.TrustedStoreLocation 属性

定义

获取或设置受信任存储区的位置,该位置下的客户端证书链已验证。

public:
 property System::Security::Cryptography::X509Certificates::StoreLocation TrustedStoreLocation { System::Security::Cryptography::X509Certificates::StoreLocation get(); void set(System::Security::Cryptography::X509Certificates::StoreLocation value); };
public System.Security.Cryptography.X509Certificates.StoreLocation TrustedStoreLocation { get; set; }
member this.TrustedStoreLocation : System.Security.Cryptography.X509Certificates.StoreLocation with get, set
Public Property TrustedStoreLocation As StoreLocation

属性值

受信任的存储区位置。

例外

试图在凭据为只读时进行设置。

示例

下面的代码演示如何设置此属性。

ClientCredentials creds = new ClientCredentials();

// Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode
    = X509CertificateValidationMode.ChainTrust;
creds.ServiceCertificate.Authentication.TrustedStoreLocation
    = StoreLocation.LocalMachine;
Dim creds As New ClientCredentials()

' Configure chain trust.
creds.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.ChainTrust
creds.ServiceCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine

该属性也可以在配置文件中设置。

注解

此属性指定是使用计算机还是用户上下文验证 X.509 证书链。

适用于