简体   繁体   中英

VSCode host .NET Core app on a specific port

From launch.json, what is the correct way to host a .NET Core on a specific port? For instance, when I run my .NET Core app, VS Code, hosts it on localhost:5000, but I instead want to host it on localhost:5050.

Thanks in advance.

You can config it via environment variable ASPNETCORE_URLS

macOS:

export ASPNETCORE_URLS=http://localhost:5050

windows:

set ASPNETCORE_URLS=http://localhost:5050

or add this to launch.json

  "env": {
    "ASPNETCORE_URLS": "http://localhost:5050"
  }

If you don't want to specify the hostname, you can use * instead

http://*:5050

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM