I have the following code:
var host = new WebHostBuilder()
.UseKestrel()
.UseUrls("https://*:" + port)
.Configure(Configure)
.Build();
which works wonderfully on windows - I can access it with https://127.0.0.1:1111 and it works fine. When I try it on a mac - it runs, but when I try and connect to it, it immediately just goes "connection closed"
I googled and found that in usekestrel, you should be able to add
.UseKestrel( options => options.UseHttps...
which is documented here:
however when I try it, I'm only finding .UseSystemd as an option - no .useHttps - even though I'm referencing Microsoft.AspNetCore.Server.Kestrel.Https.
What am I doing wrong? Why does it behave differently on mac vs windows, and how do I fix it so that it also works on the mac?
so for anyone who runs across this - I found I guess an answer: you need to run in the terminal:
dotnet dev-certs https
which then asks you to run a really bizarre command:
sudo security set-key-partition-list -D localhost ...
which magically fixes things.