SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)


Question: How do you solve the error that says "SqlException: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)".

This error occurs right after you upgrade from Asp.Net 6 to 7, any idea on how to resolve this error?



Login to See the Rest of the Answer

Answer:
When upgrading from Asp.Net Core 6 to 7, you have to implicitly let the SQL Server know to not validate the Certificate the Client Sends. This is only recommended in Development, if you deploy to the Cloud or Production Server, it is recommended you remove the flag.

In Development, you can explicitly set the flag in the SQL Server Connection String like below:

Server=IPAddress,Port;Database={DatabaseName};User ID={UserName};Password={Password};MultipleActiveResultSets=true;TrustServerCertificate=true

.Net 7
published
v.0.01





For peering opportunity Autonomouse System Number: AS401345 Custom Software Development at ErnesTech Email Address[email protected]