Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create SSL endpoint on port 443 for self-hosted OWIN listener

I am using a self-hosted OWIN listener for a Web API implementation that runs in a local process. However, I am unable to listen on port 443 successfully.

The following works:

var startOptions = new StartOptions();

startOptions.Urls.Add("http://127.0.0.1:9866");
startOptions.Urls.Add("https://127.0.0.1:9877");

webServer = WebApp.Start<PbiMockStartup>(startOptions);

However, when change the port numbers to 80 and 443, I consistently get 503 - Service Unavailable. I added the same SSL certificate for both 9877 and 443 ports using the netsh command with no luck.

I see from "netstat" that the "SYSTEM" process with PID (4) is listening on port 443 already, however I could not find a way to stop it other than disabling the HTTP.sys module, which will not work for me.

How does one go about listening on port 443 from a self-hosted OWIN listener?

like image 877
aman Avatar asked Dec 18 '25 09:12

aman


1 Answers

I tried adding URLs with "localhost" and machine-name in the startup options, but the final solution that worked out was to have a '+' like following:

var startOptions = new StartOptions();

startOptions.Urls.Add("http://+:80");
startOptions.Urls.Add("https://+:443");

webServer = WebApp.Start<MyMockClass>(startOptions);
like image 62
aman Avatar answered Dec 21 '25 09:12

aman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!