dotnet network_error ai_generated true

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

Also available as: JSON · Markdown · 中文
90%Fix Rate
81%Confidence
1Evidence
2024-03-01First Seen

Version Compatibility

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

Root Cause

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

中文

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

Official Documentation

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

Workarounds

  1. 95% success 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.
    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. 85% success 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.
    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. 80% success If running in a container, ensure the dashboard container is started and port mappings are correct. Example docker-compose snippet: ports: - "17000:17000"
    If running in a container, ensure the dashboard container is started and port mappings are correct. Example docker-compose snippet: ports: - "17000:17000"

中文步骤

  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"

Dead Ends

Common approaches that don't work:

  1. Disabling the firewall completely on the local machine. 90% fail

    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% fail

    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% fail

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