简体   繁体   English

无法从 Docker 容器(Linux 映像)连接到 SQL Server

[英]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.

相关问题 无法从 docker 容器连接到 SQL Server - Unable to connect to SQL Server from a docker container 如何从 Linux Docker 容器连接到本地 SQL Server - How to Connect to Local SQL Server From Linux Docker Container 无法通过SQL Server Management Studio连接到SQL Server Linux Docker容器 - Unable to connect to SQL Server Linux Docker container via SQL Server Management Studio Docker 容器:无法按名称连接到 SQL Server - Docker Container: Unable to connect to SQL Server by name 无法连接到Docker容器内的SQL Server - Unable to connect to SQL Server inside docker container 如何从 .net Core Linux Docker 容器(使用 Docker for Windows)连接到 Internet 上的 Sql Server? - How can I connect to a Sql Server on the internet from a .net Core Linux Docker container (using Docker for Windows)? 从 docker 容器连接到 SQL 服务器 LocalDB - Connect from a docker container to SQL Server LocalDB 无法从Docker容器连接到SQL Server - Cannot connect to SQL Server from a Docker container 在Linux Docker映像上运行的应用程序无法连接到本地Windows计算机上的SQL Server - Application running on Linux Docker image, is unable to connect to SQL server on local windows machine 无法从容器连接到远程SQL Server - Unable to connect to remote SQL server from container
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM