title: Difference between Task.Run and QueueBackgroundWorkItem in Asp.Net
body: <p>What exactly is the difference using    </p>
  
  <pre><code>Task.Run(() =&gt; { 
       LongRunningMethod();
  });
  </code></pre>
  
  <p>or</p>
  
  <pre><code>HostingEnvironment.QueueBackgroundWorkItem(clt =&gt; LongRunningMethod());
  </code></pre>
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p>So what is special about QueueBackgroundWorkItem then?</p>