SqlException: certificate chain not trusted
Version 4 of Microsoft.
includes a breaking change which sets Encrypt=True
by default. If the client and server are not configured with a valid certificate, this can cause an exception at startup:
System.Data.SqlClient.SqlException
HResult=0x80131904
Message=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.)
Source=.Net SqlClient Data Provider
It is not recommended to eliminate this warning by adding Encrypt=False
or TrustServerCertificate=True
to the connection string. Both of these options leave the endpoint unsecure.