【发布时间】:2017-01-05 12:16:18
【问题描述】:
我使用来自 http://arcware.net/upload-and-download-files-with-web-api-and-azure-blob-storage/ 的代码将 blob 上传到 azure。使用 ExecutePostProcessingAsync() 方法,我想调用一个调整图像大小并使用异步代码的方法。
我想在外观(缩小)中使用它的方法如下:
public override Task ExecutePostProcessingAsync()
{
//some code
//I would like to await the image resizer method here before going any further
resizer.ScaleImage();
//Some more code here before returning
return base.ExecutePostProcessingAsync();
}
如果我将异步添加到这样的方法中:public override async Task ExecutePostProcessingAsync()
5+ 错误将弹出参考问题以及错误:
"是一个返回'Task'的异步方法,return关键字后面不能跟对象表达式。你打算返回'Task'吗?"
问题:
在这个方法中是否有 await 一个方法?任何帮助或输入表示赞赏,谢谢!
【问题讨论】:
-
return await base.ExecutePostProcessingAsync();
标签: c# asp.net asynchronous asp.net-web-api async-await