title: HttpListener with SSL certificate hanging on GetContext()
body: <p>I've created a windows service which uses a HttpListener to respond to some third-party requests using .NET Framework 4.0. The listener is bound to a https prefix via the following:</p>
  
  <pre><code>listener.Prefixes.Add("https://+:" + Properties.Settings.Default.ListeningPort.ToString() + "/");
  </code></pre>
  
  <p>The service also self registers the https certificate in the computer store via:</p>
  
  <pre><code>X509Certificate2 certificate = new X509Certificate2(Properties.Settings.Default.HttpsCertPath, "", X509KeyStorageFlags.MachineKeySet);
  X509Store store = new X509Store(StoreLocation.LocalMachine);
  store.Open(OpenFlags.ReadWrite);
  store.Add(certificate);
  store.Close();
  </code></pre>
  
  <p>Further more, the service also registers the certificate - ip:port binding in Http API using the following:</p>
  
  <pre><code>ProcessStartInfo psi = new ProcessStartInfo();            
  psi.FileName = "netsh";
  psi.Arguments = "http add sslcert ipport=0.0.0.0:" + Properties.Settings.Default.ListeningPort.ToString() + " certhash=" + certificate.Thumbprint + " appid=" + appId;
  Process proc = Process.Start(psi);                
  proc.WaitForExit();
  psi.Arguments = "http add sslcert ipport=[::]:" + Properties.Settings.Default.ListeningPort.ToString() + " certhash=" + certificate.Thumbprint + " appid=" + appId;
  Process proc = Process.Start(psi);
  proc.WaitForExit();
  </code></pre>
  
  <p>Everything works well, as expected... EXCEPT... (and here comes the EVIL part):
  After running for some time, an hour or so, listener.GetContext() no longer returns and the clients get dropped with a "connection reset" like error.</p>