How can I configure endpoints in Kestrel?

Ok, so it turned out IISExpress was the culprit here.

For some reason, the default build configuration of Visual Studio 2017 starts my app on an IISExpress server, which does not listen to my endpoint configuration. To solve the issue, I simply had to switch to a custom run configuration.

To summary, I just had to switch from this:

enter image description here

to this:

enter image description here

(PIdea being the name of my project)


Add

"Kestrel": {
"EndPoints": {
  "Http": {
    "Url": "http://localhost:5002"
  },
  "Https": {
    "Url": "https://localhost:5003"
  }
}

}

to appsettings.json.