title: Configuration for ClientCredentials ServiceCertificate authentication not applied or used
body: <p>I am building a .NET Core 3.1 application where I am trying to call a WCF Service over HTTPS and temporarily disabling SSL authentication for the server certificate.</p>
  
  <p>There is a clearly documented way to achieve this. Namely, by setting the <code>ServiceCertificate.SslCertificateAuthentication</code> property on the <code>ChannelFactory</code> class.</p>
  
  <p>Below is code for setting up het Binding, endpoint and ClientCredentials.</p>
  
  <pre><code>var endpointAddress = new EndpointAddress("https://*.com");
  var binding = new BasicHttpsBinding();
  
  binding.Security.Mode = BasicHttpsSecurityMode.Transport;
  binding.Security.Transport = new HttpTransportSecurity()
  {
    ClientCredentialType = HttpClientCredentialType.None
  };
  
  var factory = new ChannelFactory&lt;IService&gt;(binding, endpointAddress);
  factory.Credentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
  {
    CertificateValidationMode = X509CertificateValidationMode.None,
    RevocationMode = X509RevocationMode.NoCheck
  };
  
  factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
  factory.Credentials.ServiceCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck;
  
  var client = factory.CreateChannel();
  client.Call();
  </code></pre>
  
  <p>However, when I run this code I receive the exception chain:</p>
  
  <ul>
  <li>Could not establish trust relationship for the SSL/TLS secure channel
  with authority 'domain'</li>
  <li>The SSL connection could not be established,
  see inner exception. </li>
  <li>Authentication failed, see inner exception. The</li>
  <li>message received was unexpected or badly formatted.</li>
  </ul>
  
  <p>I would expect the WCF client to have skipped SSL authentication.</p>
  
  <p>I also tried to use a custom certificate validator, by extending the <code>X509CertificateValidator</code> and configuring this in the following way:</p>
  
  <pre><code>factory.Credentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
  {
    CertificateValidationMode = X509CertificateValidationMode.Custom,
    CustomCertificateValidator = new CustomCertificateValidator();
  };
  
  factory.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.Custom;
  factory.Credentials.ServiceCertificate.Authentication.CustomCertificateValidator = new CustomCertificateValidator();
  </code></pre>
  
  <p>As you might expect as this point, I receive the same exceptions as before. Even worse though, my CustomCertificate.Validate(..) method was not being called at all.</p>
  
  <p>WCF seems to provide an API which allows for quite a bit of control but no matter what I try, my policies/configurations do not seem to by honoured in any way.</p>
  
  <p>What might be going on here?</p>