Home > OS >  .NET 7: a connection was successfully established with the server, but then an error occurred during
.NET 7: a connection was successfully established with the server, but then an error occurred during

Time:11-25

After I migrated my project to .NET 7 I had to add the TrustServerCertificate=true; setting in the connection string otherwise the following error is thrown: SqlException: A connection was successfully established with the server, but then an error occurred during the login process.

In .NET 5 or 6 this is not necessary. Can anyone tell me why it is necessary to add this setting in the connection string?

LOCAL CONNECTION STRING:

Server=localhost;Database=Xpz;Integrated Security=SSPI;TrustServerCertificate=true;

CodePudding user response:

Because of a breaking change in the SQL Server driver, see https://learn.microsoft.com/en-us/ef/core/what-is-new/ef-core-7.0/breaking-changes#encrypt-true

  • Related