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:
|
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.
|
上述問題的解決方法有兩種: 第一種:
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 下載下傳後安裝即可