title: ASP.NET Web API Async Reponses & Writes
body: <p>I have an application runs ASP.NET Web API on the backend. There's a specific controller that looks something like</p>
  
  <pre><code>public class MyController : ApiController
  {
      dynamic Post(dynamic postParams) 
      {
         var data = retrieveData(postParams.foo, postParams.bar);
         writeDataToDb(data);
         return data;
      }
  }
  </code></pre>
  
  <p>So there are three operations, the retrieval of data based on the post parameters, writing the retrieved data to a DB, and returning the retrieved data as JSON to the client.</p>
  
  <p>This could be greatly sped up if the DB write step was not blocking returning the JSON to the client, as they are not dependent on one another.</p>
  
  <p>My concern is that if I spin off the DB write off in another thread that the Post method returning will cause the process to tear-down and could potentially kill the DB write. What's the correct way to handle this scenario?</p>
  
  <p>Should I have a separate handler that I shoot an async web request to so that the DB write will occur in its own process?</p>