繁体   English   中英

为什么我的控制器动作被调用两次?

[英]Why is my controller action being called twice?

我有此控制器操作(请参阅下文),该操作将返回PDF报告/文件。 我正在使用下面的本地URL来调用此特定操作。

http:// localhost:35201 / Reports / TimeCards / f6c17d29-93fa-4a34-9aa5-d95371253d0d

由于某种原因,该动作被调用了两次。 将服务器上的资源消耗加倍。 在客户端,我在chrome开发人员工具上看到了两个调用。 第一个调用以200结尾,然后立即进行另一个调用并将其标记为已取消,但是PDF呈现仍在第二个调用的服务器上进行。

我想消除第二个电话以节省资源。 有没有人经历过类似的事情? 我将不胜感激任何帮助。

public ActionResult TimeCards(Guid id)
{
//id = BatchId

//init variables
string sigFile = string.Empty;
Guid company = GetCompanyId();

//get PayrollBatch record
PayrollBatch batch = this.payrollService.GetBatch(id);

//render report this returns a pdf file
byte[] renderedBytes = this.reportService.ProcessTimeCardReport(id, company, this);

return File(renderedBytes, "application/pdf");
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM