小编Vol*_*huk的帖子

无法从具有 ASP.NET Core 的 Docker 容器连接到 SQL Server 容器

我有一个在 ASP.NET Core 中部署 WEB API 的容器,试图连接到 SQL Server 数据库。我正在使用 Docker Desktop 运行 Windows 10。

我可以从 SQL Server Management Studio 和我的 ASP.NET Core 应用程序(无容器)成功连接到具有 SQL Server 的 Docker 容器。

但是当我在容器内运行 ASP.NET Core 时,出现错误:

fail: Microsoft.AspNetCore.Server.Kestrel[13]

      Connection id "0HMCRFGHIEO1Q", Request id "0HMCRFGHIEO1Q:00000002": An unhandled exception was thrown by the application.

      Microsoft.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct …
Run Code Online (Sandbox Code Playgroud)

c# sql-server asp.net docker asp.net-core

2
推荐指数
1
解决办法
5341
查看次数

nint 与 int 有什么区别?

我很好奇. 有人可以提供和C# 9之间的详细比较,重点关注它们在使用和行为方面的实际差异吗?intnint

int num1;
nint num2;
Run Code Online (Sandbox Code Playgroud)

我特别有兴趣了解何时适合使用nint?

c# integer

-2
推荐指数
1
解决办法
1789
查看次数

标签 统计

c# ×2

asp.net ×1

asp.net-core ×1

docker ×1

integer ×1

sql-server ×1