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 憑證。