title: WCF Troubleshooting from ASP.NET Client -- Help!
body: <p>I am trying to call a method in my service that is as below, from an ASP.NET application.  </p>
  
  <pre><code>public bool ValidateUser(string username, string password)
  {
      try
      {
          // String CurrentLoggedInWindowsUserName = WindowsIdentity.GetCurrent().Name;
          // //primary identity of the call
          // String CurrentServiceSecurityContextPrimaryIdentityName = 
          //   ServiceSecurityContext.Current.PrimaryIdentity.Name;
          //
      }
      catch (Exception ex)
      {
          FaultExceptionFactory fct = new FaultExceptionFactory();
          throw new FaultException&lt;CustomFaultException&gt;(fct.CreateFaultException(ex));
      }
      return false;
  }
  </code></pre>
  
  <p>The Config for the client end of my service is as below </p>
  
  <pre><code>&lt;binding name="WSHttpBinding_IMembershipService" closeTimeout="00:01:00"
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
       bypassProxyOnLocal="false" transactionFlow="false"
       hostNameComparisonMode="StrongWildcard"
       maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text"
       textEncoding="utf-8" useDefaultWebProxy="false" allowCookies="false"&gt;
      &lt;readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
         maxBytesPerRead="4096" maxNameTableCharCount="16384" /&gt;
      &lt;reliableSession ordered="true" inactivityTimeout="00:10:00"
         enabled="false" /&gt;
      &lt;security mode="Message"&gt;
          &lt;transport clientCredentialType="Windows" proxyCredentialType="None"
           realm="" /&gt;
          &lt;message clientCredentialType="Windows" negotiateServiceCredential="true"
           algorithmSuite="Default" establishSecurityContext="true" /&gt;
      &lt;/security&gt;
  &lt;/binding&gt;
  </code></pre>
  
  <p>Problem I keep having is when I call it; I get the following exception message. </p>
  
  <pre><code>Server Error in '/' Application. 
  
  The communication object, System.ServiceModel.Channels.ServiceChannel, 
  cannot be used for communication because it is in the Faulted state. 
  Description: An unhandled exception occurred during the execution of 
  the current web request. Please review the stack trace for more 
  information about the error and where it originated in the code. 
  
  Exception Details: System.ServiceModel.CommunicationObjectFaultedException: 
  The communication object, System.ServiceModel.Channels.ServiceChannel, 
  cannot be used for communication because it is in the Faulted state.
  
  Stack Trace: 
  
  [CommunicationObjectFaultedException: The communication object, 
    System.ServiceModel.Channels.ServiceChannel, cannot be used for 
    communication because it is in the Faulted state.]
     System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, 
           IMessage retMsg) +7596735
     System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, 
           Int32 type) +275
     System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) +0
  
     System.ServiceModel.ClientBase`1.System.ServiceModel.ICommunicationObject.
           Close(TimeSpan timeout) +142
     System.ServiceModel.ClientBase`1.Close() +38
     System.ServiceModel.ClientBase`1.System.IDisposable.Dispose() +4
     Controls.Membership.accountLogin.ValidateUserCredentials(String UserName, 
              String Password) in C:\ Petition.WebClient\Controls\
                                 Membership\accountLogin.ascx.cs:49
     Controls.Membership.accountLogin.Login1_Authenticate(Object sender, 
               AuthenticateEventArgs e) in C:\ WebClient\ Controls\Membership
                                        \accountLogin.ascx.cs:55
  </code></pre>
  
  <p>I am not entirely sure why I keep getting this. Just in case, here is how I call my service from the client</p>
  
  <pre><code>private bool ValidateUserCredentials(string UserName, string Password)
  {
      bool boolReturnValue = false;
  
      using(Members.MembershipServiceClient client =
          new Controls.Members.MembershipServiceClient())
      {
          try
          {
              boolReturnValue = client.ValidateUser(UserName, Password);
          }
          catch (FaultException&lt;CustomFaultException&gt; ex)
          {
            throw ex;
          }
      }
  
      return boolReturnValue;
  } 
  </code></pre>
  
  <p>Anyone have any idea what I need to do in this case? </p>