aspnetcore: ASPNETCORE_URLS environment variable is ignored by "dotnet run"

Repro Steps

  1. dotnet new web
  2. set ASPNETCORE_URLS=http://127.0.0.1:0
  3. dotnet run (note ASPNETCORE_URLS is ignored)
> dotnet run
Using launch settings from D:\Temp\foo2\Properties\launchSettings.json...
Hosting environment: Development
Content root path: D:\Temp\foo2
Now listening on: https://localhost:5001
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
  1. dotnet run --no-launch-profile (note ASPNETCORE_URLS is used)
> dotnet run --no-launch-profile
Hosting environment: Production
Content root path: D:\Temp\foo2
Now listening on: http://127.0.0.1:50897
Application started. Press Ctrl+C to shut down.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 21 (15 by maintainers)

Commits related to this issue

Most upvoted comments

For me to run successfully with a specified port (44360) on SSL on Windows 10 from cmd:

1.dotnet dev-certs https --trust (if not installed) 2.set ASPNETCORE_URLS=https://localhost:44360 3.dotnet run --no-launch-profile

Note this logic is built into the dotnet run tooling, it’s not any code from the aspnet org. This bug would need to be moved accordingly.