WCF HTTPS stand-alone service does not work ("server connection was reset")

I have a WCF REST service for Self-Hosted (Console App) with the following binding:

  • WebMessageEncodingBindingElement
  • HttpsTransportBindingElement (ManualAddressing = true, KeepAliveEnabled = true, AllowCookies = false, HostNameComparisonMode = Exact)

This is displayed at the HTTPS URL (" https: // mylaptop / myendpoint ")

I have a self-signed certificate issued by "mylaptop" that I assign using myServiceHost.Credentials.ServiceCertificate.SetCertificate. The certificate was successfully added, and ServiceHost opens successfully (with no exceptions). If I find "netsh http show servicestate", I see that there was a successful registration in https: // mylaptop / myendpoint with HTTP.SYS

However, when I issue the GET to the endpoint, this does not work. It seems that the socket is discarded even before receiving a valid HTTP response. (FireFox says that β€œthe connection to the server was reset,” IE says that β€œit is not possible to display the web page”, and if I make a request through Fiddler, it says β€œthe connection was forcibly closed by the remote host”).

Everything works fine when I use HTTP instead of HTTPS.

Any idea what could be wrong with HTTPS?

+4
source share
2 answers

You probably need to use httpcfg.exe to properly reserve the endpoint with HTTP.SYS with the X.509 certificate for SSL configured. The steps to complete it are documented here .

+6
source

Or use HttpCfgGui , a much more user-friendly interface for configuring w / HTTP.SYS server certificates. This is a required installation on all of my servers that run HTTP w / WCF.

+5
source

All Articles