Peter
Peter

Reputation: 849

Asp.net core web api kestrel - https working but http does not

I'm following along Microsoft's tutorial on Asp.net core web api (https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-5.0&tabs=visual-studio).

I'm trying to configure Kestrel and I've added this to appsettings.json

{
  "Kestrel": {
    "Endpoints": {
      "Http": {
        "Url": "http://localhost:5000"
      },
      "Https": {
        "Url": "https://localhost:5001"
      }
    }
  }
}

When I start the app now, https works fine, but the http connection does not work. I get "site can't be reached error".

Can someone explain why this is? If I remove the Kestrel configuration, both http and https work fine.

Upvotes: 1

Views: 1342

Answers (1)

Peter
Peter

Reputation: 849

Looks like this was an issue with Chrome, not with Kestrel.

I had changed the port to 6000 and Chrome was not letting it go through as it had marked it as an unsafe port.

Postman and curl worked fine, so I was able to look through Chrome dev tools to troubleshoot.

Upvotes: 1

Related Questions