aspire: Unable to F5 .NET Aspire Started Application from VS

Create a brand new .NET Aspire Started Application in VS and hit F5:

Unhandled exception. System.AggregateException: One or more errors occurred. (Failed to configure dashboard resource because ASPNETCORE_URLS environment variable was not set.)
 ---> Microsoft.Extensions.Options.OptionsValidationException: Failed to configure dashboard resource because ASPNETCORE_URLS environment variable was not set.

https://github.com/dotnet/aspire/assets/4403806/cc0e4c85-1876-4291-9da9-5d14fc0bd69e

At the same time, if launched from cli, everything starts up as expected:

https://github.com/dotnet/aspire/assets/4403806/1f26c03e-7f60-4085-b171-d0cfb39b01ce

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Seems I m hitting this on VSCODE on Mac

The .NET Aspire Preview 6 compatible version of C# dev kit and C# extensions are available in prerelease this week and are expecting this to be propagated to the release channel next Tuesday(5/6). image

image

Please test with these versions and let us know if you still the issue.

CC: @tmeschter

@kvenkatrajan I switched both to the preview release, and the issue has gone away. I used to have the latest stable release version, which had the issue.

I got the same error on VS Code (Windows) and found a workaround. Here’s the workaround:

  1. Open launchSettings.json in the .AppHost project.
  2. Under the https section, copy applicationUrl under the environmentVariables attribute and change its name to ASPNETCORE_URLS.
  3. Repeat the same thing under the http section.
  4. Run the .AppHost project.

It should work, and I hope it’s fixed sooner rather than later.

{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "profiles": {
    "https": {
      ...
      "applicationUrl": "https://localhost:17194;http://localhost:15214",
      "environmentVariables": {
        "ASPNETCORE_URLS": "https://localhost:17194;http://localhost:15214",
        ...
      }
    },
    "http": {
      ...
      "applicationUrl": "http://localhost:15214",
      "environmentVariables": {
        "ASPNETCORE_URLS": "http://localhost:15214",
        ...
      }
    }
  }
}