Home > Back-end >  ASP.NET Core 7.0 error on login: The certificate chain was issued by an authority that is not truste
ASP.NET Core 7.0 error on login: The certificate chain was issued by an authority that is not truste

Time:11-16

I created a simple .NET 7.0 app with SQL Server and if I use the default "localdb" or even after I change it to a "network server", I get the error below:

The certificate chain was issued by an authority that is not trusted.

My connection string is:

mysqlserver.com;Initial Catalog=db_database;User Id=db_admin;Password=pass123;Persist Security Info=True;Encrypt=true;TrustServerCertificate=yes

What am I doing wrong?

PS: With the above connection string I can scaffold the database.

CodePudding user response:

mysqlserver.com;Initial Catalog=db_database;User Id=db_admin;Password=pass123;Persist Security Info=True;Encrypt=true;TrustServerCertificate=yes;

I think this should work

CodePudding user response:

The easy fix is to set Encrypt=False; Please look at the link in the comment above. I ran across this a while back. A breaking change was introduced in Microsoft.Data.SqlClient. While making it more secure by default, the idea is that you now have to implicitly opt into a less secure connection by turning off Encrypt, which in the prior releases defaulted to false, if not set.

  • Related