c# - 增加 ReportViewer axd 处理程序的超时

标签 c# asp.net reportviewer

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

当我运行一个非常大的报表时,该报表在浏览器中呈现得很好,但是当我单击工具栏控件以导出为 PDF 或 XLS 时,我收到一个Request timed out 错误页面~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.]

我已经对此进行了一段时间的调查,我找到的最好的资源是以下 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

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

第二个也没什么用。首先,我没有使用报告服务器,因此无法按照它描述的方式为单个报告设置超时。其次,我宁愿不增加整个应用程序的超时时间——毕竟它是有原因的。我宁愿只为 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>

但这给了我“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>

最佳答案

您没有说明您使用的是哪个版本的报告查看器。较新的版本需要 asp.net 脚本管理器...

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

关于c# - 增加 ReportViewer axd 处理程序的超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16944419/

相关文章:

c# - 为什么C#的HttpClient调用不了这个URL(总是超时)?

mysql - 命令执行期间遇到 fatal error MySQL VB

c# - ReportViewer 报告到 PDF 文件

.net-3.5 - Microsoft Report Viewer Redistributable 2008 真的需要 .NET Framework 3.5 版吗?

c# - 如何从 MVVMLight 中的 ViewModel 中的 View 获取结果(调用链从 ViewModel 开始)

c# - 使用复选框更改 datagridview 中的tiny int

c# - 打开解决方案时 Visual Studio 2017 引用其他项目中的代码未解决

asp.net - 在 ASP.NET Linq 数据绑定(bind)中将 Gridview 数据导出到 Excel

c# - 如何在代码隐藏中引用 HTML &lt;textarea&gt; 控件的输入?

asp.net - SSRS ReportViewer Web 控件 - 如何在异步渲染时完全不显示 "WaitControl"?