简体   繁体   English

从 .net core 6.0 连接到运行在 Docker 的 Sql 边缘服务器

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

相关问题 无法从 Docker (Linux) 中运行的 ASP.NET Core 连接到 SQL Server 命名实例 - Can't connect to SQL Server named instance from ASP.NET Core running in Docker (Linux) 无法从运行在 docker 上的 .net 核心应用连接到 SQL Server express - Can't connect to SQL Server express from .net core app running on docker 将 ASP.NET 内核连接到 SQL 服务器 - Connecting ASP.NET Core to SQL server 从Windows Mobile 6.0连接到SQL Server 2008时发生异常 - Exception when connecting to SQL Server 2008 from windows mobile 6.0 将 Docker Web 应用程序连接到也在 ZC5FD214CDD0D2B3B4B27 中运行的 SQL 服务器实例 - Connecting a Docker Web App to a SQL Server instance that is also running in Docker 连接到Docker Container .Net Core - Connecting to Docker Container .Net Core .NET Core Web API 应用程序无法连接到在 Docker 上运行的 SQL 服务器 - .NET Core Web API Application cannot connect to SQL server running on Docker 无法从 Docker Z9E0DA8438E1E38A1C30F4B176CE7 Core 连接到 Docker SQL 服务器 - Can not connect to Docker SQL Server from Docker ASP.NET Core 3.1 C#.net Core 6.0 web 应用程序使用文件中的 RSA 密钥从 Azure 连接到雪花 - C#.net Core 6.0 web app connecting to Snowflake from Azure using RSA key in file 使用 Asp.Net Core 连接到本地 SQL 服务器数据库时遇到问题 - Trouble connecting to local SQL server database with Asp.Net Core
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM