If I have a long running async
method, which I call in my Mvc.Controller
action method without awaiting it, is it guaranteed that it will finish even after I return from the action method?
Example:
[HttpPost]
public ActionResult DoLongRunningTask() {
//not awaited async method
LongRunningTask();
return new HttpStatusCodeResult(HttpStatusCode.OK);
}
public async Task LongRunningTask() {
await Task.Delay(5000);
}
Edit:
I did find How to safely call an async method in C# without await when googling about this, but I was wondering if someone could clarify regarding ASP.NET MVC specifically. When looking closer at all the answers in the question there are some information in this answer/links: https://stackoverflow.com/a/15523793/585968, as pointed out by @MickyD.
Unless someone has some more specific information specifically regarding ASP.NET MVC, I'll accept closing this question as a duplicate.