【问题标题】:Microsoft ASP.NET ReportViewer Parser ErrorMicrosoft ASP.NET ReportViewer 解析器错误
【发布时间】:2010-10-23 15:40:27
【问题描述】:

我在网站中使用 MS ReportViewer 组件已有一段时间了,但最近我收到了如下所示的错误。

解析器错误消息:基类 包括字段“xyz”,但其 类型 (Microsoft.Reporting.WebForms.ReportViewer) 与类型不兼容 控制 (Microsoft.Reporting.WebForms.ReportViewer)。

<rsweb:ReportViewer ID="xyz" runat="server" Width="100%" Font-Names="Verdana" Font-Size="8pt" Height="400px" ProcessingMode="Local" ShowExportControls="false">

现在,我在 Visual Studio 和生产环境中都遇到了这个错误。我在生产环境中安装了 ReportViewer Redistributable。

我是否以某种方式在我的项目中遗漏了参考资料,或者其他什么?

【问题讨论】:

    标签: asp.net reportviewer


    【解决方案1】:

    我找到了答案:不知何故,对 Microsoft.Reporting.WebForms 版本 9 的引用切换到了版本 8。这导致了错误。所以删除引用并添加正确版本的引用似乎已经解决了问题。

    编辑:

    好吧,根据 .vbproj 文件的先前版本,它是对 9 的引用,尽管项目引用属性屏幕告诉我 8。总之我不确定是什么搞砸了,但是它现在似乎可以工作了。

    如果有人经历过或有一些见解,请贡献。

    【讨论】:

    • 但是告诉我一件事你是如何从 asp.net 应用程序中删除引用的?
    【解决方案2】:

    全新安装后,我的项目没有编译,因为对dll的引用被破坏了,所以我删除它并重新添加它,然后使用ReportViewer的网页出现解析器错误:

    The base class includes the field 'rprtReportsViewer', but its type (Microsoft.Reporting.WebForms.ReportViewer) is not compatible with the type of control (Microsoft.Reporting.WebForms.ReportViewer).

    我在网页上找到了与我刚刚添加的版本号不同的参考:

    <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
        Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
    

    我把版本改成了9.0.0.0,这次刷新页面时出现编译器错误:

    CS0433: The type 'Microsoft.Reporting.WebForms.ReportViewer' exists in both 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\8.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll' and 'c:\Windows\assembly\GAC_MSIL\Microsoft.ReportViewer.WebForms\9.0.0.0__b03f5f7f11d50a3a\Microsoft.ReportViewer.WebForms.dll'
    

    然后我搜索了“Microsoft.ReportViewer”的解决方案,并在compile.config中找到了更多参考:

        <add assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
        <add assembly="Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </buildProviders>
    

    我也在这里更改了版本号,它停止了错误

    【讨论】:

      【解决方案3】:

      您可能还需要从 \bin 文件中删除:

           Microsoft.ReportViewer.Common.dll
           Microsoft.ReportViewer.ProcessingObjectModel.dll
           Microsoft.ReportViewer.WebForms.dll
           Microsoft.ReportViewer.WinForms.dll
      

      我只是将它们移到一个子目录中。

      【讨论】:

        【解决方案4】:

        检查您的页面 rdlc 版本,如

        <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
        

        【讨论】:

          【解决方案5】:

          有同样的问题。使用 SQL Server 2005 和 SQL 报告清理 Windows 2008 Server 安装。服务器托管该站点。已安装 ReportViewer 2008 SP1。 Web.config 引用版本 9.0.0.0。

          出现相同的错误消息:基类包含字段,但其类型 (Microsoft.Reporting.WebForms.ReportViewer) 与控件类型 (Microsoft.Reporting.WebForms.ReportViewer) 不兼容。

          在网上搜索了很多人都遇到了同样的问题。有人建议手动编辑项目文件。 我设法通过在解决方案资源管理器->[Web 项目名称]->References->Microsoft.Reporting.WebForms->Properties 中设置 Specific Version = True (Version=9.0.0.0) 来修复它。

          在其中一种环境中,我们还在 web bin 文件夹中找到了 Microsoft.Reporting dll。而且,它们与在 GAC 中注册的 dll 冲突。删除 dll 解决了这个问题。

          【讨论】:

            【解决方案6】:

            我在生产服务器上遇到了这个问题。我安装了正确版本的 ReportViewer,并确保项目中的所有引用都指向正确的版本。但是,我仍然遇到错误。

            最终我通过转到“临时 ASP.NET 文件”并删除我的应用程序的文件解决了这个问题。为此,您需要先停止该应用程序。这然后解决了这个问题。在 DEV 服务器上我没有遇到这个问题,因为安装 ReportViewer 后我重新启动了机器。

            希望这对某人有所帮助。在解决这个特殊的“挑战”之前,我拔掉了很多头发。

            【讨论】:

              【解决方案7】:

              References -> (Microsoft.ReportViewer.WebForms),点击鼠标右键。

              指定版本选项,保留为 false。

              之后,只需保存并再次运行。

              【讨论】:

                【解决方案8】:

                我遇到了同样的错误。对我有用的是删除引用 Microsoft.ReportViewer.WebForms 并再次添加。

                【讨论】:

                  猜你喜欢
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 1970-01-01
                  • 2010-09-15
                  • 2015-07-19
                  • 1970-01-01
                  • 1970-01-01
                  • 2014-03-20
                  相关资源
                  最近更新 更多