Skip to content

Enable Aspire projects to use multiple ports configured in ASPNETCORE_URLS or applicationUrl #4727

@vfportero

Description

@vfportero

For our multitenant environment, we have configured multiple HTTPS ports for the API project on localhost as follows:

{
  "$schema": "https://json.schemastore.org/launchsettings.json",
  "profiles": {
    "Lucera.Api.SignUp": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "swagger",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_URLS": "https://localhost:40501;https://localhost:40502;https://localhost:40503;https://localhost:40504;https://localhost:40507;https://localhost:40508"
      },
      "applicationUrl": "https://localhost:40501"
    }
  }
}

When we run this launch profile directly, all the specified ports are mapped and work perfectly. However, when this profile is added to the AppHost Aspire project, only the first port works:

builder.AddProject<Projects.Lucera_Api_SignUp>("lucera-api-signup");

image

In another ticket, I noticed that it is possible to map different ports using the applicationUrl property when the protocols (http & https) are different. However, when using the same protocol with multiple ports, only the last one works.

Is there a way to achieve this with Aspire?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions