dotnet network_error ai_generated true

Aspire.Hosting.Dashboard.DashboardException: 无法在 'https://localhost:17000' 访问仪表板。连接被拒绝。请确保 .NET Aspire 仪表板正在运行。

Aspire.Hosting.Dashboard.DashboardException: The dashboard could not be reached at 'https://localhost:17000'. Connection refused. Ensure the .NET Aspire dashboard is running.

ID: dotnet/aspire-dashboard-connection-refused

其他格式: JSON · Markdown 中文 · English
90%修复率
81%置信度
1证据数
2024-03-01首次发现

版本兼容性

版本状态引入弃用备注
.NET Aspire Preview 4 (8.0.0-preview.4.24156.1) active
.NET Aspire Preview 5 (8.0.0-preview.5.24201.2) active
.NET Aspire Preview 6 (8.0.0-preview.6.24214.1) active
.NET Aspire 8.0 GA active

根因分析

.NET Aspire 仪表板服务未运行或无法在预期的地址和端口访问,通常是因为仪表板未启动、端口被阻止或托管进程崩溃。

English

The .NET Aspire dashboard service is not running or is not reachable at the expected address and port, usually because the dashboard was not started, the port is blocked, or the hosting process crashed.

generic

官方文档

https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/overview?view=aspire-8.0

解决方案

  1. Ensure the .NET Aspire dashboard is running by starting the Aspire project. In Visual Studio, press F5 or run 'dotnet run' from the project directory. Verify the dashboard URL is printed in the console output.
  2. Check if the dashboard port is already in use by another process. Use 'netstat -ano | findstr :17000' (Windows) or 'lsof -i :17000' (Linux/macOS). If in use, kill the conflicting process or configure a different port using the DOTNET_DASHBOARD_PORT environment variable.
  3. If running in a container, ensure the dashboard container is started and port mappings are correct. Example docker-compose snippet: ports: - "17000:17000"

无效尝试

常见但无效的做法:

  1. Disabling the firewall completely on the local machine. 90% 失败

    Overly aggressive and insecure; the issue is often that the dashboard process is not running, not a firewall block.

  2. Changing the dashboard URL in appsettings.json to a different port without starting the dashboard on that port. 100% 失败

    The dashboard must be listening on the configured port; changing the URL alone does not start the service.

  3. Restarting the IDE (Visual Studio) without restarting the Aspire project. 95% 失败

    Restarting the IDE does not restart the dashboard process; the project must be run again.