title: WCF Timeouts When Calling Operation in a Loop
body: <p>I've wrapped my wcf client in a IDisposable wrapper and everything appears to work correctly, I have a test case that runs this x times after around 10 times I start to get timeout's</p>
  
  <p>The calling code has the helper wrapped in a using statement, so tbh I'm at a bit of a loss</p>
  
  <p>Anyone shed any light on this?</p>
  
  <pre><code>public class CrmServiceHelper : IDisposable
  {
      private CrmServices.CRMServicesClient client;
  
      public CrmServices.CRMServicesClient GetClient
      {
          get
          {
              lock (this)
              {
                  if (client == null)
                      client = new CrmServices.CRMServicesClient();
              }
              return client;
          }
      }
      public void Dispose()
      {
          try
          {
              client.Close();
          }
          catch (CommunicationException ex)
          {
              client.Abort();
          }
          catch (TimeoutException ex)
          {
              client.Abort();
          }
      }
  }
  </code></pre>
  
  <p>Sample usage code:</p>
  
  <pre><code>    using (CrmServiceHelper client = new CrmServiceHelper())
      {
          AListReponse resp = client.GetClient.GetAList(companyId);
          if ((resp != null) &amp;&amp; (resp.AList != null))
          {
              return resp.AList ;
          }
          else
          {
              return null;
          }
      }
  </code></pre>
  
  <p>Service config</p>
  
  <p>
      
        
          
          
            
              
            
          
          
        
      
      
        
          
            
            
            
            
          
        
      
    </p>