microsoft/aspire · error · InvalidOperationException
The dashboard is not enabled for this application.
Error message
The dashboard is not enabled for this application.
What it means
The Aspire dashboard can be disabled via DistributedApplicationOptions.DisableDashboard. GetDashboardUrlAsync requires a dashboard resource to resolve a URL, so it throws when the application was configured without one.
Solutions
- Enable the dashboard (remove DisableDashboard=true / unset ASPIRE_DISABLE_DASHBOARD) if the URL is needed.
- Guard the call: check applicationOptions.DisableDashboard before invoking GetDashboardUrlAsync.
- Use resource endpoints directly instead of the dashboard URL when the dashboard is intentionally off.
Example fix
// before
var url = await app.GetDashboardUrlAsync();
// after
var opts = app.Services.GetRequiredService<DistributedApplicationOptions>();
if (!opts.DisableDashboard)
{
var url = await app.GetDashboardUrlAsync();
} Defensive patterns
Strategy: validation
Validate before calling
var opts = app.Services.GetRequiredService<DistributedApplicationOptions>();
if (opts.DisableDashboard)
{
// dashboard is off; do not call GetDashboardUrlAsync
} Type guard
static bool DashboardEnabled(DistributedApplication app) =>
!app.Services.GetRequiredService<DistributedApplicationOptions>().DisableDashboard; Try / catch
try
{
var url = await app.GetDashboardUrlAsync(ct);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("dashboard is not enabled"))
{
url = null; // app intentionally runs without a dashboard
} Prevention
- Only disable the dashboard in tests that never need its URL.
- Unset ASPIRE_DISABLE_DASHBOARD in environments where dashboard-dependent tests run.
- Centralize dashboard enable/disable configuration so tests can check it before calling.
When it happens
Trigger: Calling app.GetDashboardUrlAsync() when the AppHost was built with builder.Configuration or options setting DisableDashboard=true (or ASPIRE_DISABLE_DASHBOARD set), then attempting to fetch the dashboard URL.
Common situations: Test setups that disable the dashboard for speed or headless CI runs; apps configured with dashboard disabled for production-like runs but reusing testing helpers that assume it exists.
Related errors
- AppHost:ResourceService:ApiKey is not specified in…
- Azure provisioning options were not provided.
- Dashboard path empty or file does not exist.
- Dashboard testing is not supported in publish mode.
- The configured launch profile
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/04ec416e3e05e505.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Hosting.Testing/DistributedApplicationHostingTestingExtensions.cs:80
/// </code>
/// </example>
[AspireExportIgnore(Reason = "Use the exported getDashboardUrl overload without a cancellation token.")]
public static async Task<Uri> GetDashboardUrlAsync(
this DistributedApplication app,
CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(app);
var executionContext = app.Services.GetRequiredService<DistributedApplicationExecutionContext>();
if (executionContext.IsPublishMode)
{
throw new InvalidOperationException(Properties.Resources.DashboardUrlPublishModeExceptionMessage);
}
var applicationOptions = app.Services.GetRequiredService<DistributedApplicationOptions>();
if (applicationOptions.DisableDashboard)
{
throw new InvalidOperationException(Properties.Resources.DashboardDisabledExceptionMessage);
}
ThrowIfNotStarted(app, Properties.Resources.DashboardUrlApplicationNotStartedExceptionMessage);
cancellationToken.ThrowIfCancellationRequested();
await app.ResourceNotifications.WaitForResourceHealthyAsync(
DashboardResourceName,
WaitBehavior.StopOnResourceUnavailable,
cancellationToken).ConfigureAwait(false);
var applicationModel = app.Services.GetRequiredService<DistributedApplicationModel>();
if (!applicationModel.Resources.TryGetByName(DashboardResourceName, out var resource) ||
resource is not IResourceWithEndpoints dashboardResource)
{
throw new InvalidOperationException(Properties.Resources.DashboardUrlUnavailableExceptionMessage);
}
var httpsEndpoint = dashboardResource.GetEndpoint("https");View on GitHub (pinned to 25830f84bd)