Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One reason why this could be happening is the fact that there is one <code>HttpClient</code> instantiated on the outside of the loop. Since the loop then uses <code>HttpClientExtensions.PostAsJsonAsync</code> which takes in the <code>hc</code> variable, then it's possible that the repeated values for the keys in the <code>ConcurrentDictionary</code> is the result of <code>response</code> being overwritten as the first call to return from the <code>HttpClient</code> within all of the loop iterations. This would depend on the implementation of <code>PostAsJsonAsync</code>, but one easy way to test would be to instantiate a new <code>HttpClient</code> in the loop and see if that fixes it.</p> <p>Edit: Beware of using <code>.Result</code>, though it may not be the cause of your issue.</p> <blockquote> <p>“Async all the way” means that you shouldn’t mix synchronous and asynchronous code without carefully considering the consequences. In particular, it’s usually a bad idea to block on async code by calling Task.Wait or Task.Result. This is an especially common problem for programmers who are “dipping their toes” into asynchronous programming, converting just a small part of their application and wrapping it in a synchronous API so the rest of the application is isolated from the changes.</p> </blockquote> <p><a href="http://msdn.microsoft.com/en-us/magazine/jj991977.aspx" rel="nofollow">source</a></p> <p>Lastly, if you end up achieving only a 2x speedup when this is all working, consider tweaking this web.config tag:</p> <p><a href="http://msdn.microsoft.com/en-us/library/1tkaca2y.aspx" rel="nofollow">Sytem.NET MaxConnection property</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload