Is possible to have asynchronous and synchronous action methods in an AsyncController
? Is there any drawback doing this?
The reason is that an asynchronous operation makes sense for a time consuming operation, but does not make sense for return a form in HTML.
For example, I have a page that generates a file. The action method that returns the form with the inputs has almost no logic, but the action method that receives the POST, send it to another web service and relay the response takes some time, so it will make sense to do it asynchronously.
I could put those methods in separated controllers, one synchronous and another synchronous, but I would like to keep them together.
Cheers.
Yes.
Not really.
time consuming operation and I/O intensive so that you can benefit from I/O Completion Ports. If you have a CPU time consuming operation that you are running in a separate thread you get strictly no benefit from async controllers. At the contrary it will make things worse.
OK, web service call is an I/O intensive operation => you will get benefit from an async controller. You could have the two actions in this case on the same async controller.