To Create certificate first, Run flowing command on power shell (Administrator mode)
Create cert.
New-SelfSignedCertificate -certstorelocation cert:\localmachine\my -dnsname "localhost"
Create password on cert.
$pwd = ConvertTo-SecureString -String "Passw0rd" -Force -AsPlainText
Bind certificate to port.
Open Visual Studio Command Prompt in Administrator mode and runn the flowing command.
netsh http add sslcert ipport=0.0.0.0:21000 certhash=282FD48907C958CF8B63B65385831E9C9E2728A0
appid={f2f583ee-f065-4237-b095-b2ff5de14c42}
1.The certhash parameter specifies the thumbprint of the certificate.
2.The ipport parameter specifies the IP address and port, and functions just like the -i switch of the Httpcfg.exe tool described.
3.The appid parameter is a GUID that can be used to identify the owning application.
certhash: thumbprint of cert at creation time show on power shell windows or take from cert details or runn MMC to show details
appid: generate new guid
Bind an SSL certificate to a port number and support client certificates
runn the flowing command to bind an SSL certificate to a port number and support client certificates.
netsh http add sslcert ipport=0.0.0.0:21000 certhash=282FD48907C958CF8B63B65385831E9C9E2728A0
appid={f2f583ee-f065-4237-b095-b2ff5de14c42} clientcertnegotiation=enable
Delete cert on poart.
Netsh http delete sslcert ipport=0.0.0.0:21000
Referance:
https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-configure-a-port-with-an-ssl-certificatehttps://www.codeproject.com/Articles/24027/SSL-with-Self-hosted-WCF-Service
No comments:
Post a Comment