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

The Issue

When moving from EntityFramework v6.0 to v7.0 you may get the following exception.

Microsoft.Data.SqlClient.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.)
---- System.ComponentModel.Win32Exception : The certificate chain was issued by an authority that is not trusted.

The fix

The fix is very simple. Just add the following to the end of your connection string.

TrustServerCertificate=True;

This will stop the error from occurring.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.