title: Increasing max concurrent connections for web service in IIS7 (load testing)
body: <p>I'm trying to write a simple load tester for one of our web services, which is served through IIS7.   I'm launching a load of threads (as Tasks) that call the web service as a Web Reference.</p>
  
  <p>Despite the threads all starting, only 2 concurrent connections from the app can be handled by the web service.  </p>
  
  <p>I'm aware that by specification <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html#sec8.1.4" rel="noreferrer">simultaneous connections are limited to 2 per user</a>.  For the sake of this load tester, which I guess is one user, <strong>I would like to open many simultaneous connections.</strong></p>
  
  <p>I have tried to add the following to the web.config of the web service.</p>
  
  <pre><code>  &lt;system.net&gt;
      &lt;connectionManagement&gt;
        &lt;add address="*" maxconnection="40"/&gt;
      &lt;/connectionManagement&gt;
    &lt;/system.net&gt;
  </code></pre>
  
  <p>My setup is as follows:</p>
  
  <p>The web service is located at <a href="http://devserver/MyWebServiceApp/MyWebService.asmx" rel="noreferrer">http://devserver/MyWebServiceApp/MyWebService.asmx</a>, where MyWebServiceApp is configured as an application.</p>
  
  <p>The webmethod can be viewed as something trivial that simply waits for, say, 20 seconds before returning a response (making it easy to see that only 2 connections are open at any one time).</p>
  
  <p>The simplest form of the load tester code is ass follows: </p>
  
  <pre><code>Imports System.Threading.Tasks
  
  Module SuperBasicLoadTester
  
      Sub Main()
          ThreadLauncher(10)
      End Sub
  
      Sub ThreadLauncher(ByVal numberOfThreads As Integer)
          Dim tasks(numberOfThreads - 1) As Task
          For index As Integer = 0 To numberOfThreads - 1
              tasks(index) = Task.Factory.StartNew(AddressOf SendRequest)
          Next
          Task.WaitAll(tasks)
      End Sub
  
      Sub SendRequest()
          Dim myWebServiceCaller As New MyWebService.ServiceMethods
          myWebServiceCaller.Url = "http://devserver/MyWebServiceApp/MyWebService.asmx"
          Dim response As String = myWebServiceCaller.MyWebServiceMethod("Some string passed to the web service method")
      End Sub
  
  End Module
  </code></pre>
  
  <p>I've tried pointing other load testing software (e.g. <a href="http://www.soapui.org/" rel="noreferrer">soapUI</a>) at the web service and have observed the same issue.</p>
  
  <p>I would be grateful for any pointers as to how to increase this connection limit (for testing purposes).</p>
  
  <p><strong>Edits:</strong> </p>
  
  <ul>
  <li>I should add that the web service box is running Windows 2008 R2.</li>
  <li>Also I have run SoapUI and my loadtester simultaneously and each is
  only able to request 2 connections each (i.e. 4 in total).</li>
  </ul>
  
  <p>Thanks in advance,</p>
  
  <p>Ali</p>