报表查看器网页控件版本10尽管已正确设置,仍会出现错误。

11

报表已部署并正常工作,在报表管理器中进行了验证。

我的应用程序是一个MVC2应用程序,报表位于其自己的aspx页面上。这个页面在报表查看器控件的8版中运行良好,但我们移动到新服务器,升级了SQL Server,并尝试更新我们的网站以匹配。

服务器是带有IIS 7.5的Windows Server 2008。

我正在Chrome和IE 9中进行测试。

尽管我尽了最大的努力,仍然会出现以下错误:

报表查看器配置错误

应用程序的Web.config文件中未注册报表查看器Web控件HTTP处理程序。将<add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />添加到Web.config文件的system.web/httpHandlers部分,或将<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />添加到Internet Information Services 7或更高版本的system.webServer/handlers部分。

但是,我已经做过这个了。事实上,我甚至从MSDN中阅读了以下内容:

要在集成模式下使用IIS 7.0,必须从system.web/httpHandlers中删除HTTP处理程序。否则,IIS将无法运行应用程序,而会显示错误消息。

为了安全起见,我尝试过未对任何项进行更改,直接在IIS中添加处理程序,在我的配置文件中只添加Web服务器HTTP处理程序、仅添加HTTP处理程序以及两者组合。

让我们从我的web.config开始。

<configuration
  <system.web>
    <httpRuntime maxQueryStringLength="4096" />
    <compilation targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
        <buildProviders>
            <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
        </buildProviders>
    </compilation>
  </system.web>
  <system.webServer>
    <handlers>
        <add name="ReportViewerWebControlHandler"  preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler,  Microsoft.ReportViewer.WebForms, Version=10.0.0.0,  Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"  />
    </handlers>
  </system.webServer>
</configuration>

我有程序集、生成提供程序和处理程序。还可能出了什么问题?

3个回答

6
我找到了一个快速而不完美的解决方法 - 在您的Web配置文件中添加以下内容:
<location path="Reserved.ReportViewerWebControl.axd">
  <system.web>
    <authorization>
      <allow users="*" />
    </authorization>
  </system.web>
</location>

我在 Fiddler 中看到,当页面请求 Reserved.ReportViewerWebControl.axd 时,服务器发送了 302 转移至 login.aspx?returnurl="Reserved.ReportViewerWebControl.axd 的响应,而不是 HTTP 200 响应。因此,允许所有用户访问处理程序路径即可解决问题。


漏掉一个关键词了...我希望Josh能确认这个是否有效! :) - Lee Tickett
我无法确认这个解决方案是否有效。最终,我将SSRS控件从我的应用程序中剥离出来,并制作了自己的HTML版本。如果其他人遇到同样的问题并尝试了这个方法,请在评论中分享你的结果。 - Josh
对我有用。虽然解决方案以前没有使用,所以不确定发生了什么改变。 - benni_mac_b
这对我也起作用了。有人能解释一下发生了什么吗?我也没有改变我的解决方案。 - joshua-philpott

1

我认为这是在IIS7上的ReportViewer渲染问题。我已经手动将我的reportviewer句柄映射到IIS7,方法如下:

•打开Internet Information Services(IIS)管理器并选择您的Web应用程序。

•在IIS区域下,双击Handler Mappings图标。

•在右侧的操作窗格中,单击Add Managed Handler。

•在Add Managed Handler对话框中,输入以下内容:

请求路径:Reserved.ReportViewerWebControl.axd

类型:Microsoft.Reporting.WebForms.HttpHandler

名称:Reserved-ReportViewerWebControl-axd

•单击OK。

同时通过添加web config进行了更改


我的还是不行。我以为上面的解决方案会帮助其他人。


是的,这对我有用(IIS7,Server 2008) - odinel

-1

我曾尝试通过从ASP.NET项目中删除不需要的MVC程序集来解决这个问题。所以简单的解决方案是从Web项目的Bin文件夹中删除WebMatrix.*.dll,因为它属于MVC框架。


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