I’m busing working on a new application for a local South African company and one of the first steps is to fire up a new AspNetCore webapi app. The basic command for doing this using the DotNet CLI is no problem and looks something like this:

PS C:\myProj>dotnet new webapi -o OutputName -n ProjectName

All good so far.

The one difference I noticed between doing this in Visual Studio Code and Visual Studio 2017 is that when I use the DotNet CLI to run the app and watch for file changes at the same time is that in Visual Studio Code for some reason it automatically listened on port 5000 whereas in Visual Studio 2017 it listened on port 5000 but all requests are automatically redirected to HTTPS on port 5001.

Now in production this certainly isn’t an issue but for development I’m simply looking to use Postman to do some tests and whilst I can obviously just use port 5000, I was wondering if there was a way to configure this.

I found my answer in the Properties > launchSettings.json file under appName > applicationUrl which looks like this:

“applicationUrl”: “https://localhost:5001;http://localhost:5000”

By simply removing the first part of the value for applicationUrl so that it looks like this:

“applicationUrl”: “http://localhost:5000”

I was able to stop the behavior of redirecting to HTTPS.