Copper Contributor

I believe I have followed the necessary steps to spin up an HttpListener (C#), generate a self signed certificate, install the certificate into the certificate store, bind the certificate to the port and register the URL via netsh. However, at this point in time, my non-ssl/tls URL is working perfectly fine, but the HTTPS url is simply returning a connection refused error.

My steps:

  1. Https Listener with all prefixes added (both for http and https)
  2. Self signed certificate generated using

makecert -r -pe -n "CN=mysubdomain.mydomain.co.za" -sky exchange test.cer -sv test.pvk

  1. Conversion of certificate to PFX (so private key is included when installing into cert store)

"C:\Program Files (x86)\Windows Kits\10\bin\10.0.22000.0\x64\pvk2pfx.exe" -pvk test.pvk -spc test.cer -pfx test.pfx

  1. Installing certificate via MMC (Certificate Snap In) into both Personal Store and Trusted Root Certification Authorities. It clearly shows " You have a private key that corresponds to this certificate"

  2. Registering the HTTP and HTTPS urls via commandline NETSH.

  3. Binding the certificate to the port using

netsh http add sslcert ipport= certhash=0bb6fec9fb940d4d5733cffa5108fa48f3d546b3 appid={D288F4CC-22B2-4F5C-86D8-CB23AB90F6CF}

both appid and certhash is correct. *use to get and error due to not having the private key imbedded into the certificate.

My verifications:

  1. Checking urlacl http via

netsh http show urlacl | findstr 8483


Reserved URL : https://+:8483/myurlpath/

  1. Checking certificate via

netsh http show sslcert | findstr 8483


IP:port :

or more specifically

 IP:port                      :
Certificate Hash             : 0bb6fec9fb940d4d5733cffa5108fa48f3d546b3
Application ID               : {d288f4cc-22b2-4f5c-86d8-cb23ab90f6cf}
Certificate Store Name       : (null)
Verify Client Certificate Revocation : Enabled
Verify Revocation Using Cached Client Certificate Only : Disabled
Usage Check                  : Enabled
Revocation Freshness Time    : 0
URL Retrieval Timeout        : 0
Ctl Identifier               : (null)
Ctl Store Name               : (null)
DS Mapper Usage              : Disabled
Negotiate Client Certificate : Disabled
Reject Connections           : Disabled
Disable HTTP2                : Not Set
Disable QUIC                 : Not Set
Disable TLS1.2               : Not Set
Disable TLS1.3               : Not Set
Disable OCSP Stapling        : Not Set
Enable Token Binding         : Not Set
Log Extended Events          : Not Set
Disable Legacy TLS Versions  : Not Set
Enable Session Ticket        : Not Set

I would greatly appreciate some assistance in identifying what I've missed.

My expectation is that the URL is registered, the CERTIFICATE has been imported and bound to the port and that HTTPListener is starting up using a registered URL - however my error is ERR_CONNECTION_REFUSED

0 Replies