User request some page at my website.
What i want to do? Send to user a fast answer and start background task which take a long time.
It looks like:
public ActionResult index()
{
var task = new Task(Stuff);
//start task async
task.start();
return View();
}
public void Stuff()
{
//long time operation
}
How can i do it?
You can pass the Task StartNew() method a parameter that indicates the task you’re starting is “long running”, which provides a hint to the Task Scheduler to start the task on a new thread.