title: The HTTP request is unauthorized with client authentication scheme 'Anonymous'.
body: <p>I m trying to connect to a wcf service hosted with https </p>
  
  <p>I passed the right Credentials to the server </p>
  
  <pre><code>enter code here   var channel = new ConfigurationChannelFactory&lt;C&gt;(serviceConfigName, pluginConfig, new EndpointAddress(Url));
          if (!string.IsNullOrEmpty(UserName))
          {
              channel.Credentials.UserName.UserName = UserName;
              channel.Credentials.UserName.Password = Password;
              channel.Credentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
          }
          return channel; 
  </code></pre>
  
  <p>and I used the below configuration </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;configuration&gt;
    &lt;system.serviceModel&gt;
      &lt;client&gt;
        &lt;endpoint
            name="ms_basic_http"
            address="http://localhost"
            binding="basicHttpBinding"
            bindingConfiguration="defaultBasicHttpsBinding"
            contract="ICONTRACT" /&gt;
      &lt;/client&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding &gt;
          &lt;binding name="defaultBasicHttpsBinding"&gt;
            &lt;security mode="Message"&gt;
              &lt;transport clientCredentialType="Basic" realm="BS"   /&gt;
              &lt;message clientCredentialType="UserName"  /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
    &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>but getting the below response from the server </p>
  
  <p>The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="BS' </p>