What exactly is the difference using
Task.Run(() => {
LongRunningMethod();
});
or
HostingEnvironment.QueueBackgroundWorkItem(clt => LongRunningMethod());
I tested on an Asp.Net MVC application in which I kept on writing a line to a text file for about 10 minutes inside an asynchronous task which is invoked using Task.Run or QBWI.
It goes fine both using Task and QBWI. My async method keeps on writing to that file without any issues till 10 minutes. No disturbance from IIS I observed regarding its recycling.
So what is special about QueueBackgroundWorkItem then?