Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94

时间:2021-09-12 13:53:46

这几天为了给客户演示我们的项目,发现原来程度在开发环境和部署环境中还不太一样,原本在开发环境中程度运行的好好的,而部署后装在服务器则可能产生不少的错误。因此记录下所遇到的问题,方便以后查询同时也希望能帮遇到相关问题的朋友尽快解决问题或者避免这类的问题出现,经过googlebaidu后得出一些相关的结论:

一、 如果你的程度用到水晶报表,那就需要为服务器部署所需要的环境或程序集,否则部署后程序会出现以下错误:

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Configuration Error 
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
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. 
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Parser Error 
Message:  Could  not  load file  or  assembly  ' CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 '  or  one of its dependencies. 系统找不到指定的文件。
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Source 
Error:  
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
85 :     </pages>
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
86 :     <httpHandlers>
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
87 :       < add  verb= " GET "  path= " CrystalImageHandler.aspx "  type= " CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 " />
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
88 :     </httpHandlers>    
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
89 :     <sessionState timeout= " 360 " ></sessionState>
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94 
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Source 
File:  c: "inetpub"wwwroot"yuexiusf"web.config     Line:  87  
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Assembly Load 
Trace:  The following information can be helpful to determine why the assembly  ' CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304 '  could  not  be loaded.
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
WRN:  Assembly binding logging is turned OFF.
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94To enable assembly bind failure logging, set the registry value [HKLM"Software"Microsoft"Fusion!EnableLog] (DWORD) to 
1 .
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Note:  There is some performance penalty associated with assembly bind failure logging.
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94To turn this feature off, remove the registry value [HKLM"Software"Microsoft"Fusion!EnableLog].
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94 
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94--------------------------------------------------------------------------------
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Version 
Information:  Microsoft .NET Framework  Version: 2 . 0 . 50727 . 42 ;  ASP.NET Version:2.0.50727.42 
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94

解决方法:
 1、在你的开发环境中找到Visual Studio安装目录下的" SDK"v2.0"BootStrapper"Packages"CrystalReports,将安装文件CRRedist2005_x86.msi,复制到服务器中并安装。
 2、如果程序还不能运行,需要将水晶报表的五个dll文件复制到你的网站下的bin目录,其五大将的名称如下:
    CrystalDecisions.CrystalReports.Engine.dll
    CrystalDecisions.ReportSource.dll
    CrystalDecisions.Shared.dll
    CrystalDecisions.Web.dll
    CrystalDecisions.Windows.Forms.dll
那么他们身在何处呢?答:“在你的开发环境中C:"Program Files"Common Files"Business Objects"2.7"Managed"目录下

    
 二、如果你的项目中用了excel或者word编程时,可能会出现以下错误:
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Could  not  load file  or  assembly  ' Microsoft.Office.Interop.Word '
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Parser Error 
Message:  Could  not  load file  or  assembly  ' Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c '  or  one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Source 
Error:  
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
27 : <compilation debug= " false " >
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
28 : <assemblies>
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
29 : < add  assembly= " Microsoft.Office.Interop.Word, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c " />
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
30 : < add  assembly= " Office, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c " />
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94Line 
31
Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
解决方法:
    1、 网上说在 http://www.microsoft.com/downloads/details.aspx?FamilyId=3C9A983A-AC14-4125-8BA0-D36D67E0F4AD&displaylang=en ,下载个 O2003PIA.EXE 文件安装就行了,但我试了还是不行,或许我没有留心看其解决的方法,知道的同志麻烦说一声。Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e94
    2、后来我干脆在服务上装上了office2003,问题就问题就搞定了(虽然这样做不是很好)

三、关于登录页面的命名,如果你的页面中有个叫login.aspx的话,网站部署后可能会出现这样的错误 :
Server Error  in  ' /XX '  Application.
--------------------------------------------------------------------------------

Compilation Error 
Description:  An error occurred during the compilation of a resource required to service this request. Please review the following specific error details  and  modify your source code appropriately. 

Compiler Error 
Message:  CS0030:  Cannot convert type  ' ASP.login_aspx '  to  ' System.Web.UI.WebControls.Login '

Source 
Error:

 

Line 
112 :        public login_aspx() {
Line 
113 :            string[] dependencies ;
Line  114 :            ((Login)(this)).AppRelativeVirtualPath =  " ~/login.aspx " ;
Line  115 :            if (( global: :ASP.login_aspx.@__initialized == false)) {
Line 
116 :                dependencies = new string[ 1 ] ;
 

Source 
File:  c: "WINDOWS"Microsoft.NET"Framework"v2. 0 . 50727 "Temporary ASP.NET Files"XX"d41012e3"4462d393"App_Web_login.aspx.cdcab7d2.ip6y7oyd. 0 .cs     Line:  114  


原因:
    这是因为.net2.0中有一个叫login的控件,这样.netframework就不知道她应该选择哪个好,把你的的页面强制转换成她内置的控件,就出错了。
解决方法:
    1、不要取login这样的页面名称
    2、如果你不想改页面的名称,在其cs文件中加上命名空间,或者改其class Name如改成“User_Login”,最后不要忘了在aspx页面中改其引用如:
<% @ Page Language = " C# "  AutoEventWireup = " true "  CodeFile = " Login.aspx.cs "  Inherits = " User_Login "  %>


如果你通过以上的方法还解决不了,提议打开 C:"WINDOWS"assembly
看看相应的程序集的version是不是对上号了