title: How do I properly execute an Async Method in ASP.net MVC?
body: <p><strong>How do I execute an asynchronous method from within a controller method and return an HttpStatusCodeResult(200), without the async delegate prematurely terminating its execution?</strong></p>
  
  <p>I am working on an asp.net application and one of my action my home controller takes long time to run(10-30 sec). I want to return an HttpStatusCodeResult(200) and keep running my function. The functoin need not to return anything, but still it's not really a case of fire and forget since I return a response to the server right away with <code>HttpStatusCodeResult</code>.</p>
  
  <p>I tried using delegates, but it seems once I return the status code from the action, the delegate stops executing. Another option is to create a windows service but that would be like using a bazooka to kill a fly. I get very few requests so resources and performance is not an issue in my case. I heard <code>ThreadPool.QueueUserWorkItem</code> is an option, but which is most suitable for my case?</p>