Leo*_*uza 11 .net entity-framework .net-7.0
将项目迁移到后,.NET 7我必须TrustServerCertificate=true;在连接字符串中添加设置,否则会引发以下错误:SqlException: A connection was successfully established with the server, but then an error occurred during the login process。
在 .NET 5 或 6 中,这是不必要的。谁能告诉我为什么需要在连接字符串中添加此设置?
本地连接字符串:
Server=localhost;Database=Xpz;Integrated Security=SSPI;TrustServerCertificate=true;
Run Code Online (Sandbox Code Playgroud)
Sub*_*der 15
在appsettings.json文件中写入连接字符串:添加“TrustServerCertificate=True”
"ConnectionStrings": {
"DefaultConnection": "Server=SERVER_NAME;Database=DB_NAME;Trusted_Connection=True;TrustServerCertificate=True;",
}
Run Code Online (Sandbox Code Playgroud)
Eri*_*kEJ 10
由于 SQL Server 驱动程序发生重大更改,请参阅https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/writing-changes#encrypt-true
| 归档时间: |
|
| 查看次数: |
15243 次 |
| 最近记录: |