How exactly AsyncController avoid using ASP.NET workflow? If I use an event-based pattern (pseudo-code):
[AsyncTimeout(60000)] public void WaitForWakeUp() { AsyncManager.OutstandingOperations.Increase(); EventRaisedElsewhere += state => { AsyncManager.OutstandingOperations.Decrease(); return Content("Woke up because of " + state); }; }
... then, according to Clay Lenharts , it does not use the ASP.NET workflow. How is this possible?
I looked a bit at the AsyncController source code, but didn’t understand anything, except that it uses IAsyncResult alot and does QueueUserWorkItem in some places.
But how can BeginInvoke and QueueUserWorkItem not use an ASP.NET workflow? Of course, both of them use a thread-stream thread, and of course, in ASP.NET workflow there is only one thread pool?
According to MSDN,
The web server receives the stream from the thread pool (worker thread) and plans to process the incoming request. This worker thread initiates an asynchronous operation.
The workflow is returned to the thread pool to serve another Web request.
When the asynchronous operation is completed, it notifies ASP.NET.
But for something non-trivial, it seems that the initiators of the asynchronous operation still require the thread to work. Only in extremely simple cases (for example, using BCL to download web content) will it be fully deployed and / or fully tied to IOCP, right?
I ask in part because I see that all these chat servers are implemented using AsyncController , and if all they do is “wait for new messages”, I don’t understand how this can be done in a thread other than threadpool.