4

I have been trying to build an application in .net core 6.0, but I am facing issue while connecting it to the sql edge server running in docker.I have been running it on mac.

Here is the connection string i am using in appsettings.json.

"TheatreApiDb":"Server=localhost;Database=Theatre;User=SA;Password=P@ssw0rd;Trusted_Connection=True;"

I get this runtime error whenever i am trying to connect to the server.

Microsoft.Data.SqlClient.SqlException: "A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: TCP Provider, error: 35 - An internal exception was caught)" ---> System.Security.Authentication.AuthenticationException: "The remote certificate was rejected by the provided RemoteCertificateValidationCallback."

I have tried many things to clear this issue but couldn't resolve this.

Tried putting port number in the connection string but it didn't resolve.

1 Answer 1

5

Try adding TrustServerCertificate=True to your connection string.

For the sake of completeness, here's the full connection string

Data Source=localhost,65356;Initial Catalog=MyDatabase;User=aUser;Password=aPassword;TrustServerCertificate=True
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.