C#C
C#3y ago
Ice_

✅ Building a web api release. No HTTPS and how do I change ports?

I am trying to do a release build for a small web api I've made. I can run it but it defaults on port 5000 and it's using HTTP. I eventually get an error message when I try to use a POST on an API endpoint that is protected by a JWT. I get a http error 401 (unauthorized) and I get this in the console window:

Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.

I suspect the 401 error is because it's being sent over HTTP and not HTTPS (getting this idea from a couple of threads after googling).

I've googled a lot and all the results comes down to launchSettings.json under properties or appsettings.json but none of them even have the HTTP port 5000 in them. A few forums suggested go into project settings and go into the web tab and change the information there but there is no such tab for me.

I'm not really sure how to progress here. Help!
Was this page helpful?