title: WCF self hosted service with certificate authentication
body: <p>I have created a self-hosted WCF RESTful service with basic http authentication that runs over https with a self-signed SSL certificate. Everything works fine. When users access the service operations via a web browser,they get a pop up asking for credentials (login/password).</p>
  
  <p>Now I want to do certificate authentication instead of basic, but it does not work. The client's browser(IE/chrome/firefox) never prompts for certificate selection, I always get a HTTP 403 error and when I set a breakpoint in my custom certificate validor it never hits. So I'm definitely missing something here. I tried debugging with Fiddler and it confirms that there is no authentication header in the request.</p>
  
  <p>Here is my code to host the service.</p>
  
  <pre><code>Uri baseAdress = new Uri("https://localhost:8446/"); 
  WebServiceHost host = new WebServiceHost(typeof(RestService));
  WebHttpBinding wb = new WebHttpBinding();
  wb.Security.Mode = WebHttpSecurityMode.Transport;
  wb.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
  host.AddServiceEndpoint(typeof(IRestService), wb, baseAdress);
  host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = 
  X509CertificateValidationMode.Custom;
  host.Credentials.ClientCertificate.Authentication.CustomCertificateValidator = 
  new MyX509CertificateValidator()
  host.Open();
  </code></pre>
  
  <p>Thanks for any tips.</p>