首页 > 数据库 >Microsoft.Data.SqlClient.SqlException (provider: SSL Provider, error: 0 - 证书链是由不受信任的颁发机构颁发的。)

Microsoft.Data.SqlClient.SqlException (provider: SSL Provider, error: 0 - 证书链是由不受信任的颁发机构颁发的。)

时间:2023-02-10 14:22:04浏览次数:67  
标签:SqlClient error 颁发 Provider Data Microsoft

异常内容描述

Microsoft.Data.SqlClient.SqlException
HResult=0x80131904
Message=A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - 证书链是由不受信任的颁发机构颁发的。)
Source=Core Microsoft SqlClient Data Provider
StackTrace:
在 Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
...
内部异常 1:
Win32Exception: 证书链是由不受信任的颁发机构颁发的。

解决办法参考
https://learn.microsoft.com/zh-cn/troubleshoot/sql/database-engine/connect/certificate-chain-not-trusted?tabs=ole-db-driver-19

示例

 public const string ReadConnectString = "server=127.0.0.1;database=AdvancedDb;User ID=sa;Password=root;Trust Server Certificate=true";

标签:SqlClient,error,颁发,Provider,Data,Microsoft
From: https://www.cnblogs.com/zhuanghamiao/p/SqlException-0x80131904.html

相关文章