title: wcf with https without iis
body: <p>I currently have a Windows service that hosts a WCF service.This WCF service used to have an endpoint for net.tcp but now the service must be available outside our domain.</p>
  
  <p>The information on the internet was scarce to find info on how to use https without IIS because every example I found was with IIS.</p>
  
  <p>what I have so far is these configs: <strong>server</strong>:</p>
  
  <pre><code>&lt;bindings&gt;
    &lt;wsHttpBinding&gt;
      &lt;binding&gt;
        &lt;security mode="Transport"&gt;
          &lt;transport clientCredentialType="Certificate"/&gt;
        &lt;/security&gt;
      &lt;/binding&gt;
    &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;behaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior&gt;
          &lt;serviceCredentials&gt;
            &lt;clientCertificate&gt;
              &lt;authentication certificateValidationMode="PeerOrChainTrust"/&gt;
            &lt;/clientCertificate&gt;
            &lt;serviceCertificate findValue="JdnNetRootCA" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="Root"/&gt;
          &lt;/serviceCredentials&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;services&gt;
    &lt;service name="Jdn.Historian.Service.HistorianService"&gt;
      &lt;endpoint address="https://localhost/Historian" binding="wsHttpBinding" contract="Jdn.Historian.Schema.Service.IHistorian" /&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  </code></pre>
  
  <p><strong>client</strong></p>
  
  <pre><code>&lt;bindings&gt;
     &lt;wsHttpBinding&gt;
       &lt;binding&gt;
          &lt;security mode="Transport"&gt;
            &lt;transport clientCredentialType="Certificate" /&gt;
          &lt;/security&gt;
       &lt;/binding&gt;
     &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt;
  &lt;client&gt;
    &lt;endpoint address="https://localhost/Historian" binding="wsHttpBinding"
               contract="Historian.IHistorian" behaviorConfiguration="secure"&gt;            
    &lt;/endpoint&gt;
  &lt;/client&gt;
  &lt;behaviors&gt;
    &lt;endpointBehaviors&gt;
      &lt;behavior name="secure"&gt;
        &lt;clientCredentials&gt;
          &lt;clientCertificate findValue="JdnNetRootCA" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="Root"/&gt;
          &lt;serviceCertificate&gt;
            &lt;authentication certificateValidationMode="PeerOrChainTrust"/&gt;
          &lt;/serviceCertificate&gt;
        &lt;/clientCredentials&gt;
      &lt;/behavior&gt;
    &lt;/endpointBehaviors&gt;
  &lt;/behaviors&gt;
  </code></pre>
  
  <p>and the host is initialized like this:</p>
  
  <pre><code>var host = new System.ServiceModel.ServiceHost(typeof(Historian.Service.HistorianService));
  host.Open();
  </code></pre>
  
  <p>but I can't get it working. I get the error:</p>
  
  <blockquote>
    <p>An error occurred while making the HTTP request to <a href="https://localhost/Historian" rel="nofollow noreferrer">https://localhost/Historian</a>. This could be due to the fact that the server certificate is not configured properly with HTTP.SYS in the HTTPS case. This could also be caused by a mismatch of the security binding between the client and the server.</p>
  </blockquote>
  
  <p>I tried searching the error, but there is no concrete solution. I first want to make sure my implementation is correct. 
  So, is this the correct way of doing this? or does anyone know how to fix this issue</p>