您的位置:首页 > 运维架构

Could not load file or assembly 'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutra...

2013-10-10 15:20 627 查看
I have a problem while I put my site on server... I have a code for upload a excel file data to sql database.. so I put this assembley in my web config file
<add assembly="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
After publishing my site working on local IIS.. After puting it on server it gives follwoing error

Server Error in '/ems' 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.Office.Interop.Excel,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Source Error:

Line 46: 				<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 47: 				<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Line 48: 				<add assembly="Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
Line 49:       </assemblies>
Line 50: 		</compilation>

Source File: C:\domains\poojahostingbiz\ankit.poojahosting.biz\wwwroot\ems\web.config
Line:
48

Assembly Load Trace: The following information can be helpful to determine why the assembly
'Microsoft.Office.Interop.Excel, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' 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].

上述问题的解决方法有两种:
第一种:

1)、如果系统未安装.Net Framework,请先安装,如果已安装了的话就可直接进行第二步。

2)、在“添加或删除程序”中对Office进行“更改”安装操作,将漏装部分重新安装上去即可。具体操作如下面的图片:

如下图:添加或删除Office功能



如下图:对应用程序进行高级自定义



如下图:在“.Net 可编程性支持”选项的下拉菜单中选择“从本机运行”或“从本机运行全部程序”。



经过以上步骤的安装后,Office 2003 PIA就会被安装到GAC里去了,可以从以下目录看到:“C:\Windows\assembly”,从而如题所述的问题也就解决了。

第二种:
下载补丁包(2007 Microsoft Office System Update: Redistributable Primary Interop Assemblies), 地址是:
http://www.microsoft.com/en-us/download/details.aspx?id=18346
下载后安装即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐