title: How to call async Task from ajax aspnet core
body: <p>I am using asp.net core and I am calling async task <code>ActionResult</code> method from ajax. Its is running fine on local host but after hosting on IIS it throw 500 status code error.</p>
  
  <p><strong>But it is not calling this method is ajax code</strong></p>
  
  <blockquote>
    <p>This is ajax method:</p>
  </blockquote>
  
  <pre><code>$('.Savebtn').click(function () {
                      $.ajax({
                          url: '@Url.Action("Testing", "Home")',
                          data: "Test data",
                          type: 'POST', //POST if you want to save, GET if you want to fetch data from server
                          success: function (obj) {
                              // here comes your response after calling the server
                              alert('Suceeded');
                          },
                          error: function (obj) {
                              alert('Something happened');
                          }
                      });
              });
  </code></pre>
  
  <p><strong>This is Controller method:</strong></p>
  
  <pre><code>   [HttpPost]
  
     public async Task&lt;IActionResult&gt; Testing()
     {
         if (ModelState.IsValid)
           {
              try
              {
                 return NotFound();
              }
              catch (Exception ex)
              {
                  return NotFound();
              }
  
           }
              return View();
     }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/I13lI.png" rel="nofollow noreferrer">Error Screen Shot</a></p>