title: WCF stops responding after about 10 or so calls (throttling)
body: <p>I have a WCF Service and an application with a Service Reference to it, and with the application I have a loop and in each iteration it's making a call to a method in this wcf web-service.</p>
  
  <p>The problem is that after about 9 calls or so, it just stops...and if you hit <code>Pause</code> button of VS, you will see that it's stuck on the line where it makes the call.</p>
  
  <p>After some time waiting for it, this <strong>TimeoutException</strong> is thrown:</p>
  
  <blockquote>
    <p>The request channel timed out while
    waiting for a reply after
    00:00:59.9970000. Increase the timeout
    value passed to the call to Request or
    increase the SendTimeout value on the
    Binding. The time allotted to this
    operation may have been a portion of a
    longer timeout.</p>
  </blockquote>
  
  <hr>
  
  <p>I researched a bit on this, and found some solutions that involved editing the app.config in the application, and here are excerpts of it:</p>
  
  <pre><code>&lt;serviceBehaviors&gt;
      &lt;behavior name="ThrottlingIssue"&gt;
          &lt;serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" /&gt;
      &lt;/behavior&gt;
  &lt;/serviceBehaviors&gt;
  </code></pre>
  
  <p>.</p>
  
  <pre><code>&lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" 
   maxArrayLength="2147483647" 
   maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /&gt; 
  </code></pre>
  
  <p>Then, after I stop debugging, after a couple of minutes, an error message pops up telling me that a <strong>Catastrophic failure</strong> has occurred.</p>
  
  <p>How can I fix this problem?  I did not have this issue when I was working with a normal Web Service.</p>
  
  <hr>
  
  <p>For reference, here is the whole <code>app.config</code>:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="ThrottlingIssue"&gt;
                      &lt;serviceThrottling maxConcurrentCalls="500" maxConcurrentSessions="500" /&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
          &lt;/behaviors&gt;
          &lt;bindings&gt;
              &lt;wsHttpBinding&gt;
                  &lt;binding name="WSHttpBinding_IDBInteractionGateway" 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="true"
                      allowCookies="false"&gt;
                      &lt;readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
                          maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /&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;
              &lt;/wsHttpBinding&gt;
          &lt;/bindings&gt;
          &lt;client&gt;
              &lt;endpoint address="http://localhost:28918/DBInteractionGateway.svc"
                  binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDBInteractionGateway"
                  contract="DBInteraction.IDBInteractionGateway" name="WSHttpBinding_IDBInteractionGateway"&gt;
                  &lt;identity&gt;
                      &lt;dns value="localhost" /&gt;
                  &lt;/identity&gt;
              &lt;/endpoint&gt;
          &lt;/client&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>[Update] Solution:</strong></p>
  
  <p>Apparently, <strong>after each request you have to <code>Close</code> the connection</strong>...I am now closing the connection after each request and it's working like a charm.</p>
  
  <p><strike><em>Although what I still can't understand is that in my app.config, I set my maxConcurrentCalls and maxConcurrentSessions to 500, and yet, I can only make 10.  Anyone has any answer for that one?  (maybe I have something wrong in my app.config posted above)</em></strike></p>
  
  <p>The answer for the above question (now dashed) is because I was editing the client <code>app.config</code>, not the service config file (<code>web.config</code>)</p>