- VS: c# httplistener project, add
listener.Prefixes.Add($"https://192.168.1.xxx:4443/");*or some other ip/port - Browser: Test connecting into it, error: "Secure Connection Failed : Error code: PR_CONNECT_RESET_ERROR"
- PowerShell (as administrator) to get certhash using snippet below:
$certs = Get-ChildItem -Path Cert:\LocalMachine\My
foreach ($cert in $certs) {
$thumbprint = $cert.Thumbprint
$appid = [System.Guid]::NewGuid()
Write-Host "Certificate certhash: $thumbprint"
#Write-Host "Application ID (appid): $appid"
}- Pick one of those (2nd one is usually the correct?)
- "appid" is from your vs studio *.sln solution file, SolutionGuid =
- CommandPrompt (as administrator):
netsh http add sslcert ipport=0.0.0.0:4443 certhash=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx appid={xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} - Browser test reload: https://192.168.1.xxx:4443
- Browser: Warning about insecure cert (ERR_CERT_AUTHORITY_INVALID), press advanced, Accept and Continue
- Done!
- Open firewall port for incoming TCP 4443 (if you want other computers from LAN to connect into your webserver)
- CommandPrompt (as administrator):
netsh http delete sslcert ipport=0.0.0.0:4443
"SSL Certificate add failed, Error: 1312 A specified logon session does not exist. It may already have been terminated."
Wrong certhash with netsh command. Try other ones from the returned list.
"The parameter is incorrect."
Dont use ticks or quotes for appid='{...}' in netsh command
"Secure Connection Failed: Error code: Certificate type not approved for application., SEC_ERROR_INADEQUATE_CERT_TYPE"
Used wrong appid taken from powershell list, use another one.