Solution: The certificate chain was issued by an authority that is not trusted
Recently, I migrated a website hosted on Azure to a shared hosting server and started getting connectivity error for SQL server. The error was –
The certificate chain was issued by an authority that is not trusted
After some research, I found that the error occurs when we do not have a CA signed certificate installed in SQL database server’s trusted root store. In order to fix this issue, we can use “TrustServerCertificate=True” property in the connection string. The connection string will now look like following –
<add name="DefaultConnection" connectionString="Data Source=localhost;Database=MYDB;User ID=USERNAME;Password=PASSWORD;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" providerName="System.Data.SqlClient"></add>
Hope this post helps you. If you’re aware of any other ways of resolving this issue, let me know via comments. Cheers!