Web Wiz - Solar Powered Eco Web Hosting

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

You have an ASP.NET 8 or ASP.NET 7 application that fails to connect to to a SQL Server database with the following error.

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

The reason for the error is that SSL certificate used to encrypt the connection to the database is not trusted. There is an easy fix for this by adding TrustServerCertificate=True to the database connection string in your ASP.NET application.

1. Locate the SQL Server database connection string, usually found in the appsettings.json file.

2. The SQL Server database connection string will look like the example below.

"Server=mssql.example.com;Database=MyDatabase;User ID=MyUsername;Password=*****;"

3. Change the SQL Server database connection string to append TrustServerCertificate=True; to the end, as shown in the example below.

"Server=mssql.example.com;Database=MyDatabase;User ID=MyUsername;Password=*****;TrustServerCertificate=True;"

4. Save and publish your ASP.NET application.

5. Run your ASP.NET application again and you should find the error has gone.

Back To Hosting Knowledgebase Menu

Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.