在 Rider/Azure Data Studio 中查找数据库的连接字符串。SQL

FX_*_*tor 5 sql-server connection-string docker rider azure-data-studio

我通过 docker 使用命令创建了服务器:

\n

docker run -d \xe2\x80\x94 name MySQLServer -e \xe2\x80\x98ACCEPT_EULA=Y\xe2\x80\x99 -e \xe2\x80\x98SA_PASSWORD=your_password123\xe2\x80\x99 -p 1433:1433 mcr.microsoft.com/azure-sql-edge

\n

我正在使用 M1 Mac,一切正常。我创建了测试数据库和表。用于服务器可视化的 Studio 我使用 Rider 或 Azure Data Studio。它们都很友好,但我无法从它们获取数据库的连接字符串。我的 .NET 项目中的 appSettings 需要它。我怎样才能找到它?在 Visual Studio 中,我在 DB 的属性中找到了它。在这里我没有看到这样的选项。

\n

mon*_*.py 13

我还使用本教程中的 M1 Mac 和 SQL Edge 。在 ASP.NET WebApp 中,连接字符串如下所示:

      "ConnectionStrings": {
          "Default": "Server=localhost; Database=<insert db name>; User Id=sa; Password=your_password123"
      }
Run Code Online (Sandbox Code Playgroud)

  • 如果您使用之前的连接字符串收到此错误:“System.Security.Authentication.AuthenticationException:远程证书被提供的 RemoteCertificateValidationCallback 拒绝。”这是因为默认情况下 Encrypt 设置为 True,因此您需要添加此连接字符串:**Encrypt=False** 或 **TrustServerCertificate=true**。有关更多信息,请访问此[问题](https://github.com/dotnet/SqlClient/issues/1402) (4认同)