title: Is there any danger in using ConfigureAwait(false) in WebApi or MVC controllers?
body: <p>Say I have two scenarios:</p>
  
  <p><strong>1) WebApi Controller</strong></p>
  
  <pre><code>    [System.Web.Http.HttpPost]
      [System.Web.Http.AllowAnonymous]
      [Route("api/registerMobile")]
      public async Task&lt;HttpResponseMessage&gt; RegisterMobile(RegisterModel model)
      {
          var registerResponse = await AuthUtilities.RegisterUserAsync(model, _userService, User);
          if (registerResponse.Success) {
              var response = await _userService.GetAuthViewModelAsync(model.Username, User);
              return Request.CreateResponse(HttpStatusCode.OK, new ApiResponseDto() { Success = true, Data = response });
          }
          else {
              return Request.CreateResponse(HttpStatusCode.OK, registerResponse);
          }
  
      }
  </code></pre>
  
  <p><strong>2) MVC Controller</strong></p>
  
  <pre><code>    [Route("public")]
      public async Task&lt;ActionResult&gt; Public()
      {
          if (User.Identity.IsAuthenticated)
          {
              var model = await _userService.GetAuthViewModelAsync(User.Identity.Name);
              return View("~/Views/Home/Index.cshtml", model);
          }
          else
          {
              var model = await _userService.GetAuthViewModelAsync(null);
              return View("~/Views/Home/Index.cshtml", model);
          }
      }
  </code></pre>
  
  <p>I've been reading up on when I should use <code>ConfigureAwait</code> and it seems like I should use <code>ConfigureAwait(false)</code> on ALL of my async calls that are not tied directly to the UI.  I don't know what that means though... should I be using <code>.ConfigureAwait(false)</code> on all of the above <code>await</code> calls?</p>
  
  <p>I'm looking for some unambiguous guidelines around when exactly I should be using it.</p>
  
  <p>This question is NOT the same as the <a href="https://stackoverflow.com/questions/13489065/best-practice-to-call-configureawait-for-all-server-side-code">Best practice to call ConfigureAwait for all server-side code</a> - I am looking for a straightforward answer on the use-case for this method in the context of WebApi and MVC, not as general C#.</p>