title: SSL Certificate add failed when binding to port
body: <p>I created a WebService using WCF.  I'm doing self hosting and I want to enable HTTPS. From my understanding for this to happen, I need to create a certificate and bind to the port that I want to use.  </p>
  
  <p>Here are the steps that I've done to handle this:</p>
  
  <ol>
  <li>Created a Certificate on my local machine to act as the Root Certificate Authority 
  <ul>
  <li>makecert -n "CN=My Root Certificate Authority" -r -sv RootCATest.pvk RootCATest.cer</li>
  </ul></li>
  <li>Opened MMC.exe and imported the saved .cer file into the "Trusted Root Certificate\Certificates\ folder
  <ul>
  <li>makecert -sk MyKeyName -iv RootCATest.pvk -n "CN=MyMachineName" -ic RootCATest.cer -sr localmachine -ss my -sky exchange -pe MyMachineName.cer</li>
  </ul></li>
  <li><p>Created a temporary service certificate from the signed Root Certificate Authority</p>
  
  <ul>
  <li>makecert -sk MyKeyName -iv RootCATest.pvk -n "CN=MyMachineName" -ic RootCATest.cer -sr localmachine -ss my -sky exchange -pe MyMachineName.cer</li>
  </ul></li>
  <li><p>Tried to Bind the Certificate to the Port number (443 in this case)</p>
  
  <ul>
  <li>netsh http add sslcert ipport=0.0.0.0:443 certhash=2c5ba85bcbca412a74fece02878a44b285c63981 appid={646937c0-1042-4e81-a3b6-47d678d68ba9}</li>
  </ul></li>
  </ol>
  
  <p>The result from step 4 is the following error:</p>
  
  <blockquote>
    <p>SSL Certificate add failed, Error 1312</p>
    
    <p>A specified logon session does not exist. It may already have been terminated.</p>
  </blockquote>
  
  <p>Does anyone have a clue why I might be getting this error?</p>