ASP.NET Controller: An asynchronous module or handler completed while an asynchronous operation was still pending

后端 未结 8 1155
一个人的身影
一个人的身影 2020-11-28 09:36

I have a very simple ASP.NET MVC 4 controller:

public class HomeController : Controller
{
    private const string MY_URL = \"http://smthing\";
    private r         


        
8条回答
  •  -上瘾入骨i
    2020-11-28 10:25

    I had this error today when building an API controller. It turned out that the solution was simple in my case.

    I had:

    public async void Post()
    

    And I needed to change it to:

    public async Task Post()
    

    Note, the compiler did not warn about async void.

提交回复
热议问题