簡體   English   中英

從 .net core 6.0 連接到運行在 Docker 的 Sql 邊緣服務器

[英]Connecting to Sql Edge Server running in Docker from .net core 6.0

我一直在嘗試在 .net 核心 6.0 中構建應用程序,但在將它連接到運行在 docker 中的 sql 邊緣服務器時遇到問題。我一直在 mac 上運行它。

這是我在 appsettings.json 中使用的連接字符串。

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

每當我嘗試連接到服務器時,我都會收到此運行時錯誤。

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."

我已經嘗試了很多事情來解決這個問題,但無法解決這個問題。

嘗試將端口號放在連接字符串中,但沒有解決。

嘗試將TrustServerCertificate=True添加到您的連接字符串。

為了完整起見,這里是完整的連接字符串

Data Source=localhost,65356;Initial Catalog=MyDatabase;User=aUser;Password=aPassword;TrustServerCertificate=True

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM