I have an API which I've upgraded from .NET Core 3.1 to .NET 7. It's now throwing an error when trying to connect to the database.
The error is:
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.
I'm using VS2022, SQL Server (mcr.microsoft.com/mssql/server:2022-latest) is running in a Docker container.
The connection string is
server=127.0.0.1,1433;Initial Catalog=xxx;user id=xx;password=xxx;Encrypt=False;TrustServerCertificate=True
From the posts I've read, either Encrypt=False
or TrustServerCertificate=True
should fix this issue, but neither, or indeed, both have helped.
I have confirmed that the SQL Server instance is running ok, I can connect using SSMS, using the username and password from the connection string.
CodePudding user response:
I only added "Trust Server Certificate=True" to my connection string after I updated my app. Try to remove "Encrypt=False".
CodePudding user response:
As I previously mentioned on your Mastodon post, that's a catch-all error message for several issues.
I solved it by using the standard volume for persistence, another person mentioned on a GitHub issue that I saw that they solved it by applying the password requirements (I think they are at least 8 characters with at least one lowercase, at least one uppercase, at least one number and at least one symbol).