Could not load file or assembly 'Microsoft.ReportViewer.WebForms' or 'Microsoft.ReportViewer.Common'

 

Server Error in '/Website1' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 27:   <compilation debug="true" targetFramework="4.0">
            Line 28:    <assemblies>
            
Line 29: <add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
Line 30:   <add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            Line 31:     <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>


Source File: D:\IntranetSites\ERP\web.config Line: 29

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' could not be loaded.

WRN: Assembly binding logging is turned OFF.
            To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
            Note: There is some performance penalty associated with assembly bind failure logging.
            To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
            



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

开发端测试没有问题,但是发布至服务器之后,运行程序,即发生配置错误,未能加载“ Microsoft.ReportViewer.WebForms  ” 或者“Microsoft.ReportViewer.Common ”。

 解决与原因,是因为服务器没有找到相关的DLL组件,而在开发端能正确运行,是因为在安装VS2010时,已经有此DLL组件了。

因此可以在添加参考介面找到相关的DLL:

此时你会发现两个版本9.0和10.0版本,你拷贝开发时相对应的版本即可。拷贝到哪里?拷贝至程序集的BIN目录下。Insus.NET是10.0版本的,所以只取这两个Microsoft.ReportViewer.Common.dll 和Microsoft.ReportViewer.WebForms.dll

原文地址:https://www.cnblogs.com/insus/p/2045168.html