adsense

Sunday, October 1, 2023

.NET 7: a connection establish error

 When working with .Net 7 WEB API projects you might have encountered following error when connection to SQL Server.

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 occurs due to a breaking change in SQL driver.

This issue can be resolved by adding TrustServerCertificate=True attribute to your connection string as shown below.


"ConnectionStrings": {

    "DefaultConnection": "Server=SQL_SERVER_NAME;Database=DATABASE_NAME;Integrated Security=True;TrustServerCertificate=True;",

}

 Cheers,

Samithaa

No comments:

Post a Comment