title: IIS Queuing Requests?
body: <p>I’ve created a Windows 10 Universal App using MvvmCross and Stephen Cleary’s excellent AsyncEx library.</p>
  
  <p><strong>Update 27/10/2015 15:43 - Stephen has answered the question. Tested and proven correct.</strong></p>
  
  <p>In a view, I bind a ListView to a property in the ViewModel that asynchronously loads a collection of place holder view models called AssignableTaskPlaceholderViewModel (using AsyncEx functionality).</p>
  
  <p>The data comes from a Web API service which I’ve also created.
  For my test harness, the collection is loaded with 12  AssignableTaskPlaceholderViewModel with each simply holding an ID value.</p>
  
  <p>The DataTemplate for the ListView items then binds elements to a property on the AssignableTaskPlaceholderViewModel called AssignableTaskViewModel. This asynchronously calls another Web API method to return detailed data (again using AsyncEx functionality). This method is currently returning mock data.</p>
  
  <p>When I run the App, I would expect to see:</p>
  
  <p>1)  The initial loading of the placeholder collection taking a small amount of time, then</p>
  
  <p>2)  The detailed data for each item in the list loaded <strong>concurrently</strong>, taking roughly the same amount of time for the data to load.</p>
  
  <p>What I actually see is the detailed data being loaded <strong>sequentially</strong> i.e. it looks like IIS is queuing the requests, processing them one at a time.</p>
  
  <p>Shown below is some debug data, which shows that the initial requests processed within a second, with the responses taking between 0 and 4 seconds to complete, even though each method call is doing the same thing.</p>
  
  <p><strong>My question is: why is this occurring?</strong></p>
  
  <p>Start for Task ID 1050100111000000000034373 at 20/10/2015 15:09:52</p>
  
  <p>Start for Task ID 1050100111000000000034398 at 20/10/2015 15:09:52</p>
  
  <p>Start for Task ID 1050100111000000000034402 at 20/10/2015 15:09:52</p>
  
  <p>Start for Task ID 1050100111000000000034407 at 20/10/2015 15:09:52</p>
  
  <p><strong>Start for Task ID 1050100111000000000034431 at 20/10/2015 15:09:53</strong></p>
  
  <p>Start for Task ID 1050100111000000000034433 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034454 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034479 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034483 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034488 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034512 at 20/10/2015 15:09:53</p>
  
  <p>End for Task ID 1050100111000000000034373 at 20/10/2015 15:09:53</p>
  
  <p>Start for Task ID 1050100111000000000034514 at 20/10/2015 15:09:53</p>
  
  <p>End for Task ID 1050100111000000000034512 at 20/10/2015 15:09:53</p>
  
  <p>End for Task ID 1050100111000000000034514 at 20/10/2015 15:09:53</p>
  
  <p>End for Task ID 1050100111000000000034402 at 20/10/2015 15:09:53</p>
  
  <p>End for Task ID 1050100111000000000034407 at 20/10/2015 15:09:54</p>
  
  <p>End for Task ID 1050100111000000000034398 at 20/10/2015 15:09:54</p>
  
  <p>End for Task ID 1050100111000000000034483 at 20/10/2015 15:09:55</p>
  
  <p>End for Task ID 1050100111000000000034479 at 20/10/2015 15:09:55</p>
  
  <p>End for Task ID 1050100111000000000034488 at 20/10/2015 15:09:56</p>
  
  <p>End for Task ID 1050100111000000000034454 at 20/10/2015 15:09:56</p>
  
  <p>End for Task ID 1050100111000000000034433 at 20/10/2015 15:09:57</p>
  
  <p><strong>End for Task ID 1050100111000000000034431 at 20/10/2015 15:09:57</strong></p>
  
  <p>If I use fake data (rather than calling the Web API methods at all), with a deliberately added delay I can see that the View/ViewModel/AsyncEx plumbing is working fine.</p>
  
  <p><strong>More details:</strong></p>
  
  <p>1)  I’m calling the Web API using <strong>Windows.Web.Http.HttpClient</strong>. I use a single instance of HttpClient for all Web API method calls (which I believe is best practice).</p>
  
  <p>2)  The Web API method calls do not require authentication or an HTTPS connection.</p>
  
  <p>3)  For the HttpBaseProtocolFilter (used for the HTTPClient) I’ve set MaxConnectionsPerServer to 100.</p>
  
  <p>4)  The Web API project targets .Net 4.6 (targetFramework="4.6"). I believe this version of .Net doesn’t limit the number of connections to the server i.e. <strong>no need to add this to web.config</strong>:      .</p>
  
  <p>5)  I’ve used Async/Await “all the way”, in both the client App and the Web API methods.</p>
  
  <p>6)  Session is enabled in the Web API project.</p>
  
  <p>7) I'm running IIS 10 on my Win 10 development PC.</p>