一般当使用Excel模板时出错:Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005,解决办法:
1. 一般Window XP, Window Server 2003系统,参考http://blog.crowe.co.nz/archive/2006/03/02/589.aspx
2. Window Server 2008 X64 IIS7上述方法无法解决。
下面主要针对第二种环境中的问题以及解决方法进行阐述:
问题现象:64位Windows Server 2008操作系统的服务器读取Excel档案。
开始使用Provider=Microsoft.ACE.OLEDB.12.0引擎,无法操作,经查证Microsoft没有提供64的AccessDatabaseEngine引擎(当然也可设置IIS按照32位环境发布执行站点,如果是注册组件需要使用64位的注册命令)
尝试用如下方式读取excel档案:
using Excel = System.Microsoft.Office.Interop.Excel;
Excel.Application xApp = new Excel.ApplicationClass();
通过该种方式读取Excel档案时,提示Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following er