title: An error occurred when verifying security for the message when client try to consume WCF
body: <p>I am trying to use wcf service authentication without SSL by using this link :
  <a href="http://webservices20.blogspot.in/2008/11/introducing-wcf-clearusernamebinding.html" rel="nofollow">http://webservices20.blogspot.in/2008/11/introducing-wcf-clearusernamebinding.html</a></p>
  
  <p>Every thing goes fine till i publish the service.but when i try to consume service with asp.net webClient then it throw </p>
  
  <p>An error occurred when verifying security for the message exception</p>
  
  <p>Server stack trace: </p>
  
  <pre><code>  at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
     at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
     at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
     at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
  </code></pre>
  
  <p>my web config file is :</p>
  
  <pre><code>&lt;system.web&gt;
  &lt;compilation debug="true" targetFramework="4.0" /&gt;
  &lt;/system.web&gt;
  &lt;system.serviceModel&gt;
  &lt;extensions&gt;
  &lt;bindingExtensions&gt;
  &lt;add name="clearUsernameBinding"   type="WebServices20.BindingExtenions.ClearUsernameCollectionElement, ClearUsernameBinding" /&gt;
    &lt;/bindingExtensions&gt;
  &lt;/extensions&gt;
  &lt;bindings&gt;
    &lt;clearUsernameBinding&gt;
      &lt;binding name="myClearUsernameBinding" messageVersion="Soap12"&gt;
      &lt;/binding&gt;
    &lt;/clearUsernameBinding&gt;
  &lt;/bindings&gt;
  &lt;behaviors&gt;
    &lt;serviceBehaviors&gt;
      &lt;behavior name="SampleServiceBehaviour"&gt;
        &lt;serviceMetadata httpGetEnabled="true"/&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
        &lt;serviceCredentials&gt;
          &lt;userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="QService.MyUserNameValidator,QService" /&gt;
        &lt;/serviceCredentials&gt;
      &lt;/behavior&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="false"/&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  &lt;/behaviors&gt;
  &lt;services&gt;
    &lt;service name="QService.Service1" behaviorConfiguration="SampleServiceBehaviour"&gt;
      &lt;endpoint binding="clearUsernameBinding" bindingConfiguration="myClearUsernameBinding" contract="QService.IService1" /&gt;
    &lt;/service&gt;
  &lt;/services&gt;
  
  &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
  </code></pre>
  
  <p>
   </p>
  
  <p>and my client code is :</p>
  
  <pre><code>  ServiceReference1.ServiceClient obj = new ServiceReference1.ServiceClient();
          obj.ClientCredentials.UserName.UserName = "user";
          obj.ClientCredentials.UserName.Password = "pass";
          Response.Write(obj.GetData(45));
  </code></pre>
  
  <p>thanks in advance</p>