A connection was successfully established with the server but then an error

发布时间 2024-01-13 16:32:52作者: 算盘

 

在使用EFCore生成数据库的时候,报上面的错误!
解决方法:
加(Encrypt=True;TrustServerCertificate=True;)即可:
 
"ConnectionStrings": {
  "DefaultConnection": "Data Source=LAPTOP;Initial Catalog=DB;persist security info=True;User ID=sa;Pwd=XXXXX;Encrypt=True;TrustServerCertificate=True;"
},