title: How to configure WCF client with certificate to use the 'anonymous' authentication scheme?
body: <p>I have a pair of client and server apps who use wcf in order to pass data one way from the client to the server and it has to happen in custom binding with https and X509 certificate authentication for both, after setting configuration to "certificateOverTransport" and setting the requireClientCertificate to true on both sides the client traces the following exception to svclog: </p>
  
  <blockquote>
    <p>bad HTTP response The HTTP request is unauthorized with client authentication scheme 'Anonymous'.</p>
  </blockquote>
  
  <p>and the server side traces the following warning:</p>
  
  <blockquote>
    <p>The client certificate is invalid with native error code 0x109(see 'link' for more details) </p>
  </blockquote>
  
  <p><a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa377590(v=vs.85).aspx" rel="nofollow">the link refers to here</a> </p>
  
  <p>the client side is configured like that:</p>
  
  <pre><code>&lt;system.serviceModel&gt;
     &lt;bindings&gt;
        &lt;customBinding&gt;  
            &lt;binding name="myCustomHttpsBinding" sendTimeout="00:00:10" 
                     openTimeout="00:00:10" reciveTimeout="00:00:10"&gt;
                 &lt;reliableSession /&gt;
                 &lt;security authenticationMode="CertificateOverTransport" 
                           requireSecurityContextCancellation="true" /&gt;
                 &lt;httpsTransport authenticationScheme="Anonymous" 
                                 requireClientCertificate="true" /&gt;
            &lt;binding /&gt;
        &lt;customBinding/&gt;
     &lt;bindings /&gt;
     &lt;client&gt;
        &lt;endpoint address="https://serverAdrress:port/" 
                  behaviorConfiguration="SSLBehavior" 
                  binding="customBinding" 
                  bindingConfiquration="myCustomHttpsBinding"
                  contract="MyContract"
                  name="endpointName" /&gt;
     &lt;client /&gt;
     &lt;behaviors&gt;
       &lt;endpointBehaviors&gt;
             &lt;behavior name="SSLBehavior"&gt;
                  &lt;clientCredentials&gt;
                     &lt;clientCerificate findValue="CertSubject" 
                                       storeLocation="LocalMachine"
                                       x509FindType="FindBySubjectName"
                                       storeName="My" /&gt;
                     &lt;serviceCertificate&gt;
                         &lt;authentication    
                                 certificateValidationMode="PeerOrChainTrust"/&gt;
                     &lt;serviceCertificate /&gt;
                  &lt;clientCredentials /&gt;
             &lt;behavior /&gt;
       &lt;endpointBehaviors /&gt;
     &lt;behaviors /&gt;
  
  &lt;system.serviceModel /&gt;
  </code></pre>
  
  <p>the Server side is configured like that:</p>
  
  <pre><code>   &lt;system.serviceModel&gt;
         &lt;bindings&gt;
            &lt;customBinding&gt;  
                &lt;binding name="myCustomHttpsBinding" sendTimeout="00:00:10" 
                         openTimeout="00:00:10" reciveTimeout="00:00:10"&gt;
                     &lt;reliableSession /&gt;
                     &lt;security authenticationMode="CertificateOverTransport" 
                               requireSecurityContextCancellation="true" /&gt;
                     &lt;httpsTransport authenticationScheme="Anonymous" 
                                     requireClientCertificate="true" /&gt;
                &lt;binding /&gt;
            &lt;customBinding/&gt;
         &lt;bindings /&gt;
         &lt;services&gt;
            &lt;service behaviorConfiguration="ServiceConfig"
                     name="myService"&gt;
               &lt;endpoint address="endp1"  
                         binding="customBinding" 
                         bindingConfiquration="myCustomHttpsBinding"
                         contract="MyContract"
                         name="endpointName"
                         contract="MyContract"/&gt;
               &lt;host&gt;
                  &lt;baseAddress&gt;
                      &lt;add baseAddress="https://serverAdrress:port/" /&gt;
                  &lt;/baseAddress&gt;
               &lt;host /&gt;
            &lt;service /&gt;
         &lt;services /&gt;
         &lt;behaviors&gt;
           &lt;serviceBehaviors&gt;
                 &lt;behavior name="ServiceConfig"&gt;
                      &lt;serviceCredentials&gt;
                         &lt;clientCerificate&gt;
                               &lt;cerificate findValue="CertSubject" 
                                           storeLocation="LocalMachine"
                                           x509FindType="FindBySubjectName"
                                           storeName="My" /&gt;
                             &lt;authentication    
                                     certificateValidationMode="PeerOrChainTrust"/&gt;
                         &lt;/clientCerificate&gt;
                          &lt;serviceCertificate  findValue="CertSubject" 
                                               storeLocation="LocalMachine"
                                               x509FindType="FindBySubjectName"
                                               storeName="My" /&gt;
                      &lt;clientCredentials /&gt;
                 &lt;behavior /&gt;
           &lt;serviceBehaviors /&gt;
         &lt;behaviors /&gt;
      &lt;system.serviceModel /&gt;
  </code></pre>