title: HttpClient POST long delay before request processing on IIS, multithreading
body: <p>I have a simple console application which sends HTTP POST from multiple threads:</p>
  
  <pre><code>List&lt;Task&gt; tasks = new List&lt;Task&gt;();
  for (int i = 0; i &lt; 100; i++)
  {
      tasks.Add(Task.Factory.StartNew(() =&gt; SendQuery(url1, query1)));
      tasks.Add(Task.Factory.StartNew(() =&gt; SendQuery(url2, query2)));
  }
  
  Task.WaitAll(tasks.ToArray());
  </code></pre>
  
  <p><code>SendQuery(string uri, string requestString)</code> looks like this:</p>
  
  <pre><code>Uri url = new Uri(uri);
  
  try
  {
     using (HttpClient client = new HttpClient { Timeout = new TimeSpan(0, 0, 10, 0) })
     {
        StringContent content = new StringContent(requestString);
        content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
        HttpResponseMessage response = client.PostAsync(url, content).Result;
        response.EnsureSuccessStatusCode();
     }
  }
  catch (Exception ex)
  {
     Console.WriteLine(ex);
  }
  </code></pre>
  
  <p>The program works without any errors, all the queries are processed finally, but after filling <code>tasks</code> list each thread hangs on <code>client.PostAsync(url, content).Result</code>, after <strong>several minutes</strong> IIS starts to process queries. Why does this delay occur? What's happening during this time? I am using IIS 7.5 running on Windows Server 2008 R2 to host web-services which provide <code>url1</code> and <code>url2</code>.</p>