我想一個.xls文件轉換爲使用Microsoft.Office.Interop.Excel.Workbook
類服務器端的.xlsx文件如下:服務器執行失敗(異常來自HRESULT:0x80080005(CO_E_SERVER_EXEC_FAILURE))
workBook.SaveAs("FILENAME_HERE", XlFileFormat.xlOpenXMLWorkbook, Type.Missing, Type.Missing, Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange, Microsoft.Office.Interop.Excel.XlSaveConflictResolution.xlLocalSessionChanges, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
和我得到以下錯誤:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)). : System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
at System.Runtime.Remoting.RemotingServices.AllocateUninitializedObject(RuntimeType objectType)
at System.Runtime.Remoting.Activation.ActivationServices.CreateInstance(RuntimeType serverType)
at System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj)
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at CALLING_METHOD_IN_MY_LIBRARY_HERE...
問題是僅在暫存服務器上發生此錯誤;在我的本地機器上,它工作正常。
的事情,我已經在測試服務器上的嘗試:
- ** 1)運行DCOMCNFG打開組件服務
2)展開組件服務 「 - >」 計算機 「 - >」我的電腦 「 - >」 DCOM配置「
3)找到 」Microsoft Excel應用程序「
4)右鍵打開日。 Ë屬性對話框
5)單擊「安全」選項卡上,
6)「啓動和激活權限,配置權限,必須添加權限 - 身份下管理員聯繫用戶(該用戶),交互式用戶和運行啓動用戶
7)。啓動和激活權限+訪問權限+配置權限=>添加IIS_IUSRS +網絡服務具有完全控制研究**
2. 改變了.xls文件,從「任何CPU」,以轉換項目的構建「86 「在我的本地機器上,並在服務器上發佈這個庫。
有人想出瞭如何解決這個問題?我現在正在努力解決這個問題2天。
我知道這看起來很傻,但你有沒有在服務器上創先爭優正確安裝? –
是的,我在服務器上安裝了Excel。 –
您是否找到解決方案? –