語言

SqlConnectionStringBuilder.ServerCertificate 屬性

定義

取得或設定憑證檔案的路徑,以匹配 SQL Server 的 TLS/SSL 連線憑證。 接受的憑證格式為 PEM、DER 和 CER。 若指定,會透過驗證所提供的憑證是否ServerCertificate完全匹配來檢查 SQL Server 憑證。 (僅在 v5.1+ 中提供)

public:
 property System::String ^ ServerCertificate { System::String ^ get(); void set(System::String ^ value); };
public string ServerCertificate { get; set; }
member this.ServerCertificate : string with get, set
Public Property ServerCertificate As String

屬性值

房產價值 ServerCertificate ,或 string.Empty 是否提供任何價值。

備註

此屬性對應於 連接字串 中的「Server Certificate」與「ServerCertificate」鍵。

Note

當 ServerCertificate 指定時,伺服器所呈現的憑證會與從此路徑載入的憑證進行比較,包括當所呈現的憑證已通過鏈與名稱驗證時。 完全匹配即可滿足憑證驗證。

若所呈現的憑證不符,或無法載入或解析檔案,TLS 握手失敗;配置 ServerCertificate 從不會被默默忽略。

憑證驗證本身可被停用 TrustServerCertificate=true (除非, Encrypt=strict因為驗證總是執行)。 當驗證被停用時, ServerCertificate 則不會被諮詢。

適用於