開啟任何報表皆提示:「未能為 SSL/TLS 安全通道建立信任關係」 (The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.)
SSRS 組態檔 rsreportserver.config 中啟用了 SSL 驗證 (SecureConnectionLevel 設定為 2 或以上),但伺服器憑證不受信任 (自簽、過期、CN 不符、缺少中繼 CA) 或用戶端未正確信任根憑證。
C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.configMSRS13.MSSQLSERVER 為 SQL 2016)<Configuration> 區段下的 SecureConnectionLevel:<SecureConnectionLevel>0</SecureConnectionLevel>
0 = 僅 HTTP,不加密1 = 僅登入加密2 = 全部加密 (預設造成此錯誤的值)3 = 全部加密 + 要求用戶端憑證net stop ReportServer && net start ReportServer (或透過 SQL Server Configuration Manager)。netsh http add sslcert 綁定原生 HTTP.SYS 端點 (原生模式)。SecureConnectionLevel 設回 2 (或 3),重啟服務驗證。// C# 範例:呼叫前插入
System.Net.ServicePointManager.ServerCertificateValidationCallback =
(sender, certificate, chain, sslPolicyErrors) => true;
警告:生產環境嚴禁使用,會暴露中間人攻擊風險。
openssl s_client -connect :443 -showcerts 檢視憑證鏈完整性。\LogFiles) 查看詳細錯誤堆疊。