On ASP.NET MVC 2 asynchronous controllers, are Action Filters activated asynchronously?

In ASP.NET MVC 2 asynchronous controllers, we can do something like this:

public class SomeController : AsyncController { [Blurb] public void FooAsync() { this.AsyncManager.OutstandingOperations.Increment(); Task.Factory.StartNew( () => { this.AsyncManager.Parameters["result"] = new BazResult(); this.AsyncManager.OutstandingOperations.Decrement(); }); } public ActionResult FooCompleted(ActionResult result) { return result; } } 

My question is, does the Reset action filter perform asynchronously? In other words, is its synchronous nature automatically wrapped in an asynchronous call?

+6
source share
1 answer

I looked under the covers in AsyncControllerActionInvoker , and it looks like it really completes them in a set of asynchronous calls and continuations. It calls the BeginInvokeActionMethodWithFilters call, which in turn sets InvokeActionMethodFilterAsynchronously .

For the curious, the source is in the code.

+2
source

Source: https://habr.com/ru/post/887407/


All Articles