Certificate Chain Error
Since the update to Microsoft.Data.SqlClient v4, encryption is used for the connections to the SQL databases.
In many cases (e.g.: local SQL servers) the encrypted connection will fail with this error:
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.)
It means that the certificate, used by the SQL server, is not trusted by the client. Local SQL servers use self-signed certificates by default.
Solution 1: TrustServerCertificate=True
The first and easiest solution is to force the client into trusting the SQL server certificate. This can be easily configured by adding TrustServerCertificate=True to the connection strings in the appsettings.json file(s).
"ConnectionStrings": {
"OmetaFrameworkDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaFramework.Master;trusted_connection=yes;",
"OmetaDcsDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaDynamicCaseSystem.Master;trusted_connection=yes;",
"OmetaBamDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaBAMLogging;trusted_connection=yes;"
}
Becomes
"ConnectionStrings": {
"OmetaFrameworkDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaFramework.Master;trusted_connection=yes;TrustServerCertificate=True;",
"OmetaDcsDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaDynamicCaseSystem.Master;trusted_connection=yes;TrustServerCertificate=True;",
"OmetaBamDatabase": "Data Source=SQL\\MYSQLSERVER;database=OmetaBAMLogging;trusted_connection=yes;TrustServerCertificate=True;"
}
Solution 2: Use Trusted Certificate
Another solution is to configure a certificate on your SQL server(s) which is signed by a trusted authority.
Consult this article for more information about using/configuring certificates on SQL server.