我的应用程序正在使用 ReportViewer WebControl。我没有使用 SSRS - 只是 ReportViewer 绑定(bind)到 sql 数据源。

当我运行一个非常大的报告时,该报告将在浏览器中呈现得很好,但是当我单击工具栏控件以导出为 PDF 或 XLS 时,我在大约 2 分钟后得到一个 Request timed out 错误页面:

Server Error in '/' Application.
Request timed out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Request timed out.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Request timed out.]

我已经对此进行了一段时间的调查,我发现的最佳资源是以下 2 页。

http://www.developmentnow.com/g/115_2005_5_0_0_532058/How-to-set-Report-manager-PDF-export-timeout.htm

Reporting Services Report Timeout

第一个链接很有趣,但没有给出实际答案,而且我在查询字符串中没有看到 Timeout 参数(见下文)。

第二个也没有真正的帮助。首先,我没有使用报告服务器,因此无法按照它描述的方式设置单个报告的超时。其次,我宁愿不增加整个应用程序的超时 - 毕竟它存在是有原因的。我宁愿只为 Reserved.ReportViewerWebControl.axd 增加它,因为这是导致错误的路径 - 当您将报告导出为 pdf 等时,它会打开一个指向 Reserved.ReportViewerWebControl.axd 的直接链接。就我而言,这是:



所以我决定在 web.config 中更改这个特定处理程序的 executionTimeout:



但这给了我“位置元素未使用。在 Reserved.ReportViewerWebControl.axd 中找不到项目项。路径 C:\...Reserved.ReportViewerWebControl.axd not fuond”。

这是有道理的,因为 Reserved.ReportViewerWebControl.axd 实际上并不作为文件存在。

我如何使这项工作?

编辑

我正在使用 ReportViewer 的 v11:
<httpHandlers>
  <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"
    validate="false" />
</httpHandlers>

最佳答案

您尚未说明您使用的是哪个版本的报表查看器。较新的版本需要一个 asp.net 脚本管理器...

如果您的版本需要脚本管理器,请尝试更改超时属性 AsyncPostBackTimeout

10-06 13:14