0

当我在本地运行我的代码时,没问题..但是当我在服务器上运行我的代码时,我遇到了这个错误:

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

它给出了这一行的错误:

excelObj = new Microsoft.Office.Interop.Excel.Application();

这是描述:

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Source Error: 


Line 169:            Microsoft.Office.Interop.Excel.Workbook workbook = null;
Line 170:
Line 171:            excelObj = new Microsoft.Office.Interop.Excel.Application();
Line 172:
Line 173:            System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

此错误与我的代码或我的服务器有关吗?

提前致谢..在此处输入图像描述

4

1 回答 1

3

这意味着 Excel 互操作程序集未在生产服务器上注册。这很好,因为您真的不想在自动化环境(如 ASP.NET)中使用 Office 互操作。检查文章的替代品。

于 2012-08-06T08:47:17.957 回答