Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed while configure exe in task scheduler

余生颓废 提交于 2019-12-02 11:47:26

问题


I have created console application in C# to read a Excel file. Used microsoft interop dll to manipulate excel file. The excel file is created in Excel 2013. .net version is 4.5 OS : windows server 2012

It will open the excel file and add a row sheet with values.

The functionality is working fine. But when I configure the exe in task scheduler I am getting an error.

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

Also I have tried to run the exe in command prompt with the same user credential which was used to configure the task in scheduler.

My Question is, the exe working fine in the command prompt but not working in task scheduler.

Any thoughts??


回答1:


Option1:

Try the following steps

  1. In DCOMCNFG, right click on the My Computer and select properties.
  2. Choose the COM Securities tab
  3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for \Users.
  4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for \Users

Have a look into this link if there any permission problems

Option 2:

if you can't find the reason, just switch your solution as Save AS method



来源:https://stackoverflow.com/questions/30116940/retrieving-the-com-class-factory-for-component-with-clsid-00024500-0000-0000-c0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!