title: How to call WCF Rest service with Basic Auth using Postman?
body: <p>I have created a WCF service with Basic Authentication following this article <a href="https://docs.microsoft.com/en-gb/dotnet/framework/wcf/feature-details/transport-security-with-basic-authentication" rel="nofollow noreferrer">https://docs.microsoft.com/en-gb/dotnet/framework/wcf/feature-details/transport-security-with-basic-authentication</a>.
  But when I call it using Postman, I get an error (400 Bad Request).</p>
  
  <p>If I use a small application written in C# setting out ClientCredentials, it works well.</p>
  
  <p>Here is my server code:</p>
  
  <pre><code>public class DataService : IDataService
  {
      public bool GetData()
      {
          return true;
      }
  }
  </code></pre>
  
  <pre><code>[ServiceContract]
  public interface IDataService
  {
      [OperationContract]
      [WebInvoke(Method = "GET", UriTemplate = "GetData")]
      bool GetData();
  }
  </code></pre>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;appSettings&gt;
      &lt;add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /&gt;
    &lt;/appSettings&gt;
    &lt;system.web&gt;
      &lt;compilation debug="true" targetFramework="4.6.2" /&gt;
      &lt;httpRuntime targetFramework="4.6.2"/&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;protocolMapping&gt;
          &lt;add binding="basicHttpsBinding" scheme="https" /&gt;
      &lt;/protocolMapping&gt;    
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /&gt;
      &lt;bindings&gt;
          &lt;wsHttpBinding&gt;
              &lt;binding name="UsernameWithTransport"&gt;
                  &lt;security mode="Transport"&gt;
                      &lt;transport clientCredentialType="Basic" /&gt;
                  &lt;/security&gt;
              &lt;/binding&gt;
          &lt;/wsHttpBinding&gt;
      &lt;/bindings&gt;
          &lt;services&gt;
              &lt;service name="BasicAuthenticationTest"&gt;
                  &lt;endpoint 
                      address=""
                      binding="wsHttpBinding"   
                      bindingConfiguration="UsernameWithTransport"  
                      name="BasicEndpoint"  
                      contract="BasicAuthTest.IDataService"/&gt;
              &lt;/service&gt;
          &lt;/services&gt;
      &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;directoryBrowse enabled="true"/&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/TD4PQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TD4PQ.jpg" alt="enter image description here"></a></p>
  
  <p>I also turned off "SSL certificate verification" and proxy in Postman</p>