“证书链是由不受信任的颁发机构颁发的”的问题处理

作者:动易软件 来源:本站原创 点击数: 发布时间:2023年10月04日

问题分析:网站运行日志提示:

Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - 证书链是由不受信任的颁发机构颁发的。)

 ---> System.ComponentModel.Win32Exception (0x80090325): 证书链是由不受信任的颁发机构颁发的。

处理办法:

修改appsettings.json 中的数据库链接,增加Encrypt=True;TrustServerCertificate=True;

 "ConnectionStrings": {

    "DbConnectionString": "Data Source = DESKTOP-Q11URM8;Initial Catalog = Furion;User Id = sa;Password = sa;Encrypt=True;TrustServerCertificate=True;"

  }