How to set default port for ASP.NET Core in VS Code?

If you want to do this the VS Code way, as long as you use F5 (or the Run > “Start Debugging” command), it’s as simple as changing the launch.json file from this:

...
"env": {
    "ASPNETCORE_ENVIRONMENT": "Development"
},
...

to this:

...
"env": {
    "ASPNETCORE_ENVIRONMENT": "Development",
    "ASPNETCORE_URLS": "http://localhost:5001"
},
...

Otherwise, if you use the IIS Express profile, edit your launchSettings.json file to specify the port:

"iisSettings": {
  "iisExpress": {
    "applicationUrl": "http://localhost:6000",
  }
},
"profiles" : { ... }

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top