[英]Connecting to Sql Edge Server running in Docker from .net core 6.0
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.我一直在尝试在 .net 核心 6.0 中构建应用程序,但在将它连接到运行在 docker 中的 sql 边缘服务器时遇到问题。我一直在 mac 上运行它。
Here is the connection string i am using in appsettings.json.这是我在 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.尝试将端口号放在连接字符串中,但没有解决。
Try adding TrustServerCertificate=True
to your connection string.尝试将
TrustServerCertificate=True
添加到您的连接字符串。
For the sake of completeness, here's the full connection string为了完整起见,这里是完整的连接字符串
Data Source=localhost,65356;Initial Catalog=MyDatabase;User=aUser;Password=aPassword;TrustServerCertificate=True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.