ASP.NET HttpContext.Current inside Task.Run
问题 I have a following code example that is used in ASP.NET MVC application. The purpose of this code is to create "fire and forget" request for queuing some long running operation. public JsonResult SomeAction() { HttpContext ctx = HttpContext.Current; Task.Run(() => { HttpContext.Current = ctx; //Other long running code here. }); return Json("{ 'status': 'Work Queued' }"); } I know this is not a good way for handling HttpContext.Current in asynchronous code, but currently our implementation not