[英]Unable to connect to SQL Server from Docker container (Linux image)
In our application we are using linux based container which access SQL server installed on VM.在我们的应用程序中,我们使用基于 linux 的容器访问安装在 VM 上的 SQL 服务器。 Everything works fine in local environment outside the container, But when I ran the app in local container we are getting the below error.
在容器外的本地环境中一切正常,但是当我在本地容器中运行应用程序时,我们收到以下错误。
"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" “已成功与服务器建立连接,但在登录前握手期间发生错误。(提供程序:TCP 提供程序,错误:35 - 捕获到内部异常”
appsetings.json
"ConnectionStrings": {
"DbConnection": "Server=tcp:vmname\\sqlservername,49763;Database=dbname;User ID=username_Users;Password=pwd;MultipleActiveResultSets=true;Integrated Security=False;"
}
Dockerfile文件
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
.......
Any inputs will be appreciated任何输入将不胜感激
请将;TrustServerCertificate=true添加到您的连接字符串中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.