在Controller Action中异步等待:错误:无法等待'void'

Sag*_*r K 1 c# asp.net-mvc asynchronous asp.net-mvc-4

我正在使用async控制器动作返回jsonresult.并发送通知方法返回void.

public async Task<JsonResult> SetStatus(string msg)
{
    await SendNotification(msg);
}
Run Code Online (Sandbox Code Playgroud)

我收到错误'无法等待'无效'

Tig*_*ran 5

SendNotification必须Task通过await关键字定义返回.

这是一种javascript承诺,(只给你一个想法),它必须有done,failed功能,为了异步功能能够跟踪执行流程.