title: OperationCanceledException on stress test
body: <p>I just made an WebApi (C#, .net 4.5.2) and published it to the web. In order to make sure it working good, I started a to test it. </p>
  
  <p>The REST web-service failed the "stress" test. I sent the service 30+- http requests, each second, and got back this typical error message:</p>
  
  <pre><code>System.OperationCanceledException: The operation was canceled.
     at System.Threading.CancellationToken.ThrowOperationCanceledException()
     at System.Net.Http.HttpContentExtensions.&lt;ReadAsAsyncCore&gt;d__0`1.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Web.Http.ModelBinding.FormatterParameterBinding.&lt;ExecuteBindingAsyncCore&gt;d__0.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Web.Http.Controllers.HttpActionBinding.&lt;ExecuteBindingAsyncCore&gt;d__0.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()
  --- End of stack trace from previous location where exception was thrown ---
     at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
     at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
     at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
     at System.Web.Http.Controllers.ExceptionFilterResult.&lt;ExecuteAsync&gt;d__0.MoveNext()
  </code></pre>
  
  <p>Same error occurred many times in the log.</p>
  
  <p>When I entered the specific machine, I saw that the CPU is on 100% and the RAM is on 80%. Which mean, the machine gives her best to handle the load. </p>
  
  <h2>Questions</h2>
  
  <ol>
  <li>According to the StackTrace I provided above, I cannot understand
  where exactly was the problem in my code?</li>
  <li>My code is scale out automatically (hosted in the cloud). But, new machine created only after 5 minutes (depends on the average CPU > 50%). How should I handle sudden mass of HTTP request? Maybe the server should say: "Hey, try agian in 30 seconds" or something like that? What is the right solution?</li>
  </ol>