增加ReportViewer axd处理程序的超时时间

4

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

当我运行一个非常大的报表时,报表在浏览器中可以正常呈现,但当我点击工具栏控件导出为 PDF 或 XLS 时,大约 2 分钟后会出现“请求超时”错误页面:

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.]

我已经调查了一段时间,发现最好的资源是以下两个页面。

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

报告服务报表超时

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

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

Reserved.ReportViewerWebControl.axd?Culture=2057&CultureOverrides=True&UICulture=2057&UICultureOverrides=True&ReportStack=1&ControlID=cf991107384446f8859b148bc815745b&Mode=true&OpType=Export&FileName=InvoicesReport&ContentDisposition=OnlyHtmlInline&Format=PDF

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

<location path="Reserved.ReportViewerWebControl.axd">
    <system.web>
      <!-- Set execution timeout to 10 minutes, default is 110 seconds -->
      <httpRuntime executionTimeout="600"/>
    </system.web>
  </location>
但是这给了我一个“位置元素未使用。在Reserved.ReportViewerWebControl.axd中未找到项目。路径C:\...Reserved.ReportViewerWebControl.axd未找到”的错误提示。
这是有道理的,因为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>
1个回答

2
您还没有说明您使用的是哪个版本的报表查看器。较新的版本需要使用asp.net scriptmanager...
如果您的版本需要scriptmanager,请尝试更改timeout属性AsyncPostBackTimeout

我在 ScriptManager 中添加了 AsyncPostBackTimeout="600"。但它仍然超时 - 大约 2.5 分钟后。 - Kev
很奇怪...你收到了什么错误信息? - bastos.sergio
2
尝试在您的web.config中增加executionTimeout - bastos.sergio
1
我已经尝试过,并且它按照我的预期工作。但是,我在我的问题中已经说过这不是一个理想的解决方案。我已经尝试过,但没有成功地为Reserved.ReportViewerWebControl.axd设置executionTimeout(请参见我的问题)。顺便说一下,我认为asyncpostbacktimeout建议无法奏效的原因是axd直接打开(在新标签页中)。它只是简单地获取axd httphandler url - 即:不是aspx页面,也没有涉及scriptmanager。因此,在报告页面上的脚本管理器不参与生成pdf并将其写入响应中,而是httphandler执行此操作。 - Kev
你从未说明更改该键是否有效。你说你只尝试影响Reserved.ReportViewerWebControl.axd,但没有成功...(我认为你想要的是不可能的,你必须更改整个站点的属性)。如果这是不可接受的,请创建一个仅包含报表查看器页面+控件的单独站点,并相应地更改该站点中的web.config文件。关于asyncpostbackt,你是正确的,你没有因为asyncpostback而超时,但在你发布错误消息后,我才能找出原因。 - bastos.sergio
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接