title: WCF Custom Authentication not working
body: <p>Trying to implement a simple 'username'/'password' authentication for wcf service. But its just not working. No errors/exceptions.
  Here is the web config code:</p>
  
  <pre><code>    &lt;?xml version="1.0"?&gt;
      &lt;configuration&gt;     
          &lt;system.web&gt;
              &lt;compilation debug="true" targetFramework="4.0"/&gt;
              &lt;customErrors mode="Off"/&gt;
          &lt;/system.web&gt;
          &lt;system.serviceModel&gt;
        &lt;services&gt;
        &lt;service name="XYZService"
                 behaviorConfiguration="XYZBehavior"&gt;        
          &lt;!-- use base address specified above, provide one endpoint --&gt;
          &lt;endpoint address=""
                    binding="basicHttpBinding"
                    bindingConfiguration="XYZBinding"
                    contract="IXYZService" /&gt;
          &lt;!--&lt;endpoint address="mex"
                    binding="mexHttpBinding"
                    contract="IMetadataExchange" /&gt;--&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;bindings&gt;
        &lt;basicHttpBinding&gt;
          &lt;binding name="XYZBinding"&gt;
            &lt;security mode="TransportCredentialOnly"&gt;
              &lt;transport clientCredentialType="Basic" /&gt;
            &lt;/security&gt;
          &lt;/binding&gt;
        &lt;/basicHttpBinding&gt;
      &lt;/bindings&gt;
          &lt;behaviors&gt;
                  &lt;serviceBehaviors&gt;
                      &lt;behavior&gt;
                          &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt;
                          &lt;serviceMetadata httpGetEnabled="true"/&gt;
                          &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
                          &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
                          &lt;serviceCredentials&gt;
                              &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="XYZBinding.LicensingServer.CCustomValidatorClass, XYZBinding.LicensingServer"/&gt;
                          &lt;/serviceCredentials&gt;
                      &lt;/behavior&gt;
                  &lt;/serviceBehaviors&gt;
              &lt;/behaviors&gt;
              &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true"/&gt;
          &lt;/system.serviceModel&gt;
          &lt;system.webServer&gt;
              &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
          &lt;/system.webServer&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p>Validate Code:</p>
  
  <pre><code>public class CCustomValidatorClass : UserNamePasswordValidator
      {
          public override void Validate(string userName, string password)
          {
              if(userName != "Test" || password != "1234567")
              {
                  throw new FaultException("The provided credentials are invalid.");
              }
          }
      }
  </code></pre>
  
  <p>There are no errors or exceptions. I am able to call the service and execute without any credentials. On local debugging the validate method is never hit.</p>
  
  <p>I have no idea what is getting missed out.</p>