无法加载文件或程序集'Microsoft.ReportViewer.WebForms'

Kri*_*hna 47 asp.net reportviewer reporting-services

我试图在asp.net中使用报表查看器并上传我的网站.但是,当加载包含报表查看器的页面时,它会显示以下错误:

无法加载文件或程序集'Microsoft.ReportViewer.WebForms,Version = 11.0.0.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

这是我第一次部署ASP.NET网站,所以我不确定问题是什么.

Eri*_*icG 60

这个链接给了我一个线索,我没有安装所需的更新(我有问题的版本nr,v11.0.0.0)

ReportViewer 2012更新'Gotcha'要注意

我安装了更新SQLServer2008R2SP2

我下载了ReportViewer.msi,它需要为Microsoft®SQLServer®2012安装Microsoft®SystemCLR Types (在安装程序的页面中间看一下)

在GAC现在可用WebForms v11.0.0.0(C:\Windows\assembly\Microsoft.ReportViewer.WebForms v11.0.0.0以及Microsoft.ReportViewer.Common v11.0.0.0)

  • 在新安装的dll被选中之前,还需要重新启动应用程序池. (4认同)
  • **更新:** 考虑使用 NUGET - 请参阅 Microsoft 文章 [“使用 ReportViewer 控件集成 Reporting Services - 入门”](https://learn.microsoft.com/) 中的“更新现有项目以使用 ReportViewer 控件”部分en-us/sql/reporting-services/application-integration/integrating-reporting-services-using-reportviewer-controls-get-started?view=sql-server-2017#updating-an-existing-project-to-use- -reportviewer-control)。通过 NUGET 更新后,检查“CopyLocal”设置(应设置为 true)。 (4认同)

Kas*_*oma 34

我已经安装了Microsoft.ReportViewer.2012.Runtime nuget包,问题已解决,无需安装ReportViewer.msi或sql功能包12

在此输入图像描述

  • 这对我有用.我需要在只有v11可用的构建服务器(TeamCity)上获得v12 .dll.NuGet上有一个2015年发布包 (2认同)

jmo*_*eno 23

您需要引用Microsoft.ReportViewer.WebForms和Microsoft.ReportViewer.Common并将CopyLocal属性设置为true.这将导致dll被复制到我们的bin目录(两者都是必需的).

  • 我按照上面的步骤引用了"Microsoft.ReportViewer.WebForms"(v11)但找不到"Microsoft.ReportViewer.Common"(v11).任何想法为什么我看不到`common`库? (4认同)

小智 8

我通过复制这两个问题解决了这个问题

  • 来自的Microsoft.ReportViewer.WebForms.dllC:\Program Files (x86)\Microsoft Visual Studio 12.0\ReportViewer
  • 和来自的Microsoft.reportviewer.common.dllC:\Program Files\Microsoft Office\Office15\ADDINS\PowerPivot Excel Add-in

进入bin文件夹(网站).

当然web.config必须有:

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

    <assemblies>

        <add assembly="Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
        <add assembly="Microsoft.ReportViewer.Common, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845DCD8080CC91" />
    </assemblies>

    <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </buildProviders>

    <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <handlers>
            <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
        </handlers>
    </system.webServer>
Run Code Online (Sandbox Code Playgroud)

就这样.对我来说没问题.

希望这可以帮助.


Ami*_*tal 0

将文件 Microsoft.ReportViewer.WebForms.dll 上传到 Web 应用程序的 bin 目录。

您可以在本地 Web 应用程序的 bin 目录中找到此 dll 文件。