[英]await async WCF method
I must be missing something obvious here. 我必须在这里遗漏一些明显的东西。 But I cant see wat I did wrong.
但我不能看到我做错了。 I have the following code:
我有以下代码:
var resp = await client.findItemsByCategoryAsync(request);
But this code give me the following compiler error: 但是这段代码给了我以下编译器错误:
Though it says awaitable I cannot use the await keyword. 虽然它说等待我不能使用await关键字。 The method is provided by a WCF service (Ebay Finding API)
该方法由WCF服务提供(Ebay Finding API)
The method containing the await
operator must also be declared as async
. 包含
await
运算符的方法也必须声明为async
。
public async void YourMethodAsync()
{
var resp = await client.findItemsByCategoryAsync(request);
}
The error message refers the current method, not the one you're calling await on. 错误消息引用当前方法,而不是您正在调用的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.