SubmitGenerateReportAsync问题。 Await运算符只能与Async方法一起使用 [英] SubmitGenerateReportAsync Issue. Await operator can only be used with Async Method

查看:97
本文介绍了SubmitGenerateReportAsync问题。 Await运算符只能与Async方法一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在尝试使用以下内容提交下载关键字效果报告的请求。

I am trying to submit a request to download keyword performance report using following .

  var reportId =等待SubmitGenerateReportAsync(reportRequest);它给了我错误 

 var reportId =await SubmitGenerateReportAsync(reportRequest); its giving me error 

这是  ; SubmitGenerateReportAsync方法。我已经在定义中使用异步。不确定还有什么问题。

Here is the SubmitGenerateReportAsync method. I am already using async in definition. Not sure what else is wrong.

与PollGenerateReportAsync相同的问题

Same issue with PollGenerateReportAsync

  reportStatus = await PollGenerateReportAsync(reportId.ToString( ));

 reportStatus =await PollGenerateReportAsync(reportId.ToString());

让我知道它是否易于修复。

Let me know if its easy fix.

推荐答案

找到问题并修复它。看起来这个调用的方法也应该是异步的。

Found the issue and fixed it. Seems like the method from which this call is made should be async too.

但是现在有一个新问题。当我运行SubmitGenerateReportAsync方法时,它不返回任何内容。它只是结束了该计划。甚至没有去我尝试PollGenerateReportAsync的下一行。 

But now there is a new issue. When I run SubmitGenerateReportAsync method it doesnt return anything back. It just ends the program. Doesnt even go to the next line where I try to PollGenerateReportAsync. 

不确定什么是错的。如果我尝试下载的代码就可以了。我的是控制台应用程序..剂量工作。

Not sure whats wrong..If I try the Downloaded code it works. Mine is console app.. dosent work.


这篇关于SubmitGenerateReportAsync问题。 Await运算符只能与Async方法一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆