{"record":{"id":"ad315e4639eed378","repo":"microsoft/aspire","slug":"dashboard-endpoint-is-only-available-when-running-as-an","errorCode":null,"errorMessage":"Dashboard endpoint is only available when running as an emulator.","messagePattern":"Dashboard endpoint is only available when running as an emulator\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Aspire.Hosting.Azure.Functions/DurableTask/DurableTaskSchedulerResource.cs","lineNumber":61,"sourceCode":"                ParameterResource parameterResource => ReferenceExpression.Create($\"{parameterResource}\"),\n                string value => ReferenceExpression.Create($\"{value}\"),\n                _ => throw new InvalidOperationException($\"Unexpected connection string type: {connectionStringAnnotation.ConnectionString.GetType().Name}\"),\n            };\n        }\n\n        throw new InvalidOperationException($\"Unable to resolve the Durable Task Scheduler connection string. Configure the scheduler using {nameof(DurableTaskResourceExtensions.RunAsEmulator)}() or {nameof(DurableTaskResourceExtensions.RunAsExisting)}(connectionString) before accessing {nameof(ConnectionStringExpression)}.\");\n    }\n\n    private ReferenceExpression CreateDashboardEndpoint()\n    {\n        if (IsEmulator)\n        {\n            var dashboardEndpoint = new EndpointReference(this, \"dashboard\");\n\n            return ReferenceExpression.Create($\"{dashboardEndpoint.Property(EndpointProperty.Url)}\");\n        }\n\n        throw new InvalidOperationException(\"Dashboard endpoint is only available when running as an emulator.\");\n    }\n}\n","sourceCodeStart":43,"sourceCodeEnd":64,"githubUrl":"https://github.com/microsoft/aspire/blob/25830f84bd145686607ad00c057b3f84e2e51d43/src/Aspire.Hosting.Azure.Functions/DurableTask/DurableTaskSchedulerResource.cs#L43-L64","documentation":"The Durable Task Scheduler resource in Aspire.Hosting.Azure.Functions exposes a dashboard endpoint URL, but that endpoint is only provisioned when the scheduler resource runs in emulator mode. Accessing the dashboard endpoint property on a non-emulator (real Azure) scheduler resource throws this InvalidOperationException, since no local dashboard is hosted.","triggerScenarios":"Calling the dashboard endpoint URL expression (via EmulatorDashboardEndpoint / CreateDashboardEndpoint) on a DurableTaskSchedulerResource that was NOT configured with .RunEmulator(), e.g. when pointing at a real Azure Durable Task Scheduler instance.","commonSituations":"Developers build locally against a real scheduler instead of the emulator, or switch from emulator mode to production mode and existing code that read the dashboard URL keeps executing; apps that unconditionally render or pass the dashboard URL fail at model build time.","solutions":["Configure the scheduler resource for local development with .RunEmulator() so the dashboard endpoint exists.","Guard dashboard URL access: only read the endpoint when the resource is in emulator mode (check the emulator flag/configuration before calling).","If targeting a real scheduler, use the Azure-hosted Durable Task Dashboard instead of the Aspire-provided emulator endpoint."],"exampleFix":"// before\nvar dashboardUrl = schedulerResource.EmulatorDashboardEndpoint();\n\n// after\nif (schedulerIsEmulator)\n{\n    var dashboardUrl = schedulerResource.EmulatorDashboardEndpoint();\n}\nelse\n{\n    // use the Azure portal dashboard for the real scheduler\n}","handlingStrategy":"validation","validationCode":"if (!schedulerResource.IsEmulator) // or check the RunEmulator flag/config\n{\n    throw new InvalidOperationException(\"Dashboard endpoint requires emulator mode; call .RunEmulator() for local dev.\");\n}\nvar dashboardUrl = schedulerResource.EmulatorDashboardEndpoint();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only call EmulatorDashboardEndpoint in local-development code paths gated on emulator mode.","Centralize dashboard URL retrieval behind a helper that checks the mode once.","When migrating from emulator to real scheduler, audit all dashboard URL consumers."],"tags":["azure","durable-task-scheduler","emulator","endpoint"],"backgroundTag":"invalid-state-transition","analyzedSha":"25830f84bd145686607ad00c057b3f84e2e51d43","analyzedAt":"2026-09-16T11:10:06.193Z","contentChangedAt":"2026-09-16T11:10:06.193Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}