共用方式為


X509CertificateRecipientClientCredential.DefaultCertificate 屬性

定義

取得或設定用於服務的預設憑證。

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

屬性值

用於服務的預設憑證。

例外狀況

已嘗試設定認證何時是唯讀的。

範例

這段程式碼將示範如何存取這個屬性。

public void snippet24(CalculatorClient cc)
{
    X509CertificateRecipientClientCredential rcc = cc.ClientCredentials.ServiceCertificate;
    X509Certificate2 cert = rcc.DefaultCertificate;
}

備註

對於使用以憑證為基礎之訊息安全性的繫結,這個憑證會用來加密傳送給服務的訊息,而且預期會被服務用來簽署對用戶端的回覆。

適用於