title: async await inside MVC controller
body: <p>I  have a controller action method that returns JSON result.
  In this controller action, i want to do asyc and await for a long running operation without waiting for the JSON result to return to the browser.</p>
  
  <p>I have below sample code - </p>
  
  <pre><code>`public JsonResult GetAjaxResultContent(string id)
          {
              List&lt;TreeViewItemModel&gt; items = Test();
              //use the below long running method to do async and await operation.
              CallLongRunningMethod();
  
              //i want this to be returned below and not wait for long running operation to complete
  
              return Json(items, JsonRequestBehavior.AllowGet);
          }
  
  
  private static async void CallLongRunningMethod()
          {
  
              string result = await LongRunningMethodAsync("World");
  
          }
  
          private static Task&lt;string&gt; LongRunningMethodAsync(string message)
          {
              return Task.Run&lt;string&gt;(() =&gt; LongRunningMethod(message));
          }
  
          private static string LongRunningMethod(string message)
          {
              for (long i = 1; i &lt; 10000000000; i++)
              {
  
              }
              return "Hello " + message;
          }
  
  `
  </code></pre>
  
  <p>However, the controller action waits untill it finishes the long running method and then returns the json result.</p>