我有一个在 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# 9之间的详细比较,重点关注它们在使用和行为方面的实际差异吗?intnint
int num1;
nint num2;
Run Code Online (Sandbox Code Playgroud)
我特别有兴趣了解何时适合使用nint?