title: Use Async Method at Service Layer from MVC 5?
body: <p>I am developing an ASP.NET MVC 5 Application.  I have been reading  some questions <a href="https://stackoverflow.com/questions/18502745/fire-and-forget-async-method-in-asp-net-mvc">here</a> that suggest not to use the type of behavior I want.</p>
  
  <p>High Level of what I want to achieve -</p>
  
  <p>MVC Controller - calls method at Service Layer and then continues to next line of code in controller as does not need to return anything.</p>
  
  <p>Method in Service Layer - I want to to call some external Web Service that has Async methods so I want these to run off on and then write data to the DB when they return.</p>
  
  <p>Is something like this achievable or not the Best Approach?</p>
  
  <p>To Dummy this out and Test the principle I have the following on controller:</p>
  
  <pre><code>    [AcceptVerbs(HttpVerbs.Post)]
      public ActionResult TestAsync()
      {
          _myService.TestAsync();
  
          return RedirectToAction("Summary");
      }
  </code></pre>
  
  <p>At _myService the method looks as follows:</p>
  
  <pre><code>    public async Task TestAsync()
      {
          await Task.Delay(10000);
  
          var test = "Testing";
  
         _testRepository.Add(test);
      }
  </code></pre>
  
  <p>I was hoping that this TestAsync Method would wait 10 seconds and then I could check the DB and the value Testing would be added.  However this is not working - On The UI after hitting the button the page goes to the Summary View and the await Task.Delay breakpoint is hit but the next lines never execute.  Is there something incorrect with the approach?  Should the TestAsync method just look something like:</p>
  
  <pre><code>    public void TestAsync()
      {
         //Call another private async method here in the class that does the task delay
         //which would be similar to calling the actual Async External Web Service methods
          var test = "Testing";
  
         _testRepository.Add(test);
      }
  </code></pre>