上一篇中讲解了利用Excel.exe进程导入Excel,如果有朋友使用我提供的代码就会发现,在启动Excel进程时出现抛出异常错误,错误信息是:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.
解决该问题还需要对DCOM进行配置,下面是配置步骤:
1) 运行dcomcnfg打开组件服务;
2) 依次展开“组件服务”-> "计算机" -> "我的电脑" -> "DCOM配置"
3) 找到“Microsoft Excel应用程序”
4) 右击打开属性对话框
5) 点击“安全”选项卡
6) 把"启动和激活权限",“访问权限”,“配置权限",都选择为自定义,依次点击它们的编辑;
7) 如果IIS是IIS 5.0,将ASPNET添加进去,并加入所有的权限;如果IIS是IIS 6.0, 将NETWORK SERVER添加进去,并加入所有权限;
8) 点击“标识”选项卡,选择“交互式用户”.
根据上面步骤即可。