4

I'm trying to get familiar with TPL and using it in mvc. All looks ok in all guides (mark action as async, use await => profit!) but I don't really understand it.

As I understand chain of calls looks like this: client sends http request → web server gets request → mvc action handler finds controller and action using routing rules and executes it → action writes result in response.

BUT: What is kind of magic in router wait for action? Who (and how?) handles the first async method in this chain?

NASSER
  • 5,900
  • 7
  • 38
  • 57
mtkachenko
  • 5,389
  • 9
  • 38
  • 68
  • 1
    [When I should use Async Controllers in ASP.NET MVC](http://stackoverflow.com/questions/30566848/when-i-should-use-async-controllers-in-asp-net-mvc), [The Magic of using Asynchronous Methods in ASP.NET 4.5 plus an important gotcha](http://www.hanselman.com/blog/TheMagicOfUsingAsynchronousMethodsInASPNET45PlusAnImportantGotcha.aspx), [Do asynchronous operations in ASP.NET MVC use a thread from ThreadPool on .NET 4](http://stackoverflow.com/questions/8743067/do-asynchronous-operations-in-asp-net-mvc-use-a-thread-from-threadpool-on-net-4), and so on. – CodeCaster Sep 04 '15 at 10:05

1 Answers1

0

I will try to explain as I understand:

Who is waiting: Your server, for example IIS. Router didn't do anything like a magic there, just running via simple mvc pipeline with one long time operation execution on one of the levels.

How is waiting: If you know that your app has some long running tasks, you should change some configurations in your web server for high concurrency. You can read how it can be done there Server Configuration for High Concurrency/High Latency Web Service Calls. It give you possibility prevent HTTP 503 status.

I hope it give some global view, if I understood your question right.

ivamax9
  • 2,601
  • 24
  • 33