Skip to content

Aspire AppHost/dashboard defaults no longer seem to apply #9999

Open
@DamianEdwards

Description

@DamianEdwards

If you create an Aspire project and then delete or otherwise disable the launch profiles and start the AppHost project, it will fail to launch with errors indicating that it can't start because URLs for the dashboard have not been set. This used to work as we had default values for all the URLs (UI, AppHost resource endpoint, OTLP GRPC/HTTP endpoint) but seems we lost this.

This means AppHost projects can't be run unless they have a properly configured launch profile. We'd like simple AppHost projects like one based on .NET 10 file-based apps to work even when they have no launch profile, so we should make this work again.

Here's what the current error looks like:

Unhandled exception. System.AggregateException: One or more errors occurred. (Failed to configure dashboard resource because ASPNETCORE_URLS environment variable was not set.; Failed to configure dashboard resource because ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL and ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URL environment variables are not set. At least one OTLP endpoint must be provided.)
 ---> Microsoft.Extensions.Options.OptionsValidationException: Failed to configure dashboard resource because ASPNETCORE_URLS environment variable was not set.; Failed to configure dashboard resource because ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL and ASPIRE_DASHBOARD_OTLP_HTTP_ENDPOINT_URL environment variables are not set. At least one OTLP endpoint must be provided.
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.UnnamedOptionsManager`1.get_Value()
   at Aspire.Hosting.Dashboard.DashboardLifecycleHook.AddDashboardResource(DistributedApplicationModel model) in /_/src/Aspire.Hosting/Dashboard/DashboardLifecycleHook.cs:line 101
   at Aspire.Hosting.Dashboard.DashboardLifecycleHook.BeforeStartAsync(DistributedApplicationModel appModel, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dashboard/DashboardLifecycleHook.cs:line 64
   at Aspire.Hosting.DistributedApplication.ExecuteBeforeStartHooksAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 475
   at Aspire.Hosting.DistributedApplication.RunAsync(CancellationToken cancellationToken) in /_/src/Aspire.Hosting/DistributedApplication.cs:line 425
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at System.Threading.Tasks.Task.Wait()
   at Aspire.Hosting.DistributedApplication.Run() in /_/src/Aspire.Hosting/DistributedApplication.cs:line 456
   at Program.<Main>$(String[] args) in D:\src\local\aspire\9.4\AspireStarter\AspireStarter.AppHost\AppHost.cs:line 12

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions