Create self-signed cert
New-SelfSignedCertificate -Subject "SomeWebApi"
Get cert thumbprint
Get-ChildItem -path cert:\LocalMachine\My
Add the ssl binding (I'm pretty sure the ApplicationID is a random GUID - you can generate one at https://www.guidgenerator.com/)
Add-NetIPHttpsCertBinding
-IpPort "0.0.0.0:8181"
-ApplicationId "{12345678-db90-4b66-8b01-88f7af2e36bf}"
-CertificateHash "3876BF4236E1A7B2C3A29FB1793924575609FA59"
-CertificateStoreName "My"
-NullEncryption $false
Register the acl
$port=8181
$domainUser="Everyone"
& netsh http add urlacl url=https://+:$port/ user=$domainUser
If you still get errors after this make sure there are no duplicate acl bindings
& netsh http show urlacl
which can be removed using
& netsh http delete urlacl url=https://+8181/
NOTE: In the Owin WebApi make sure the WebAp is listening on same url (notice the https and +) https://+:8181/