Share via

Getting the below exception while accessing Excel using Microsoft Interop - running application from Task Scheduler (Under Run whether user is logged on or not)

Anonymous
2023-09-01T19:11:23+00:00

Exception :

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)).

Stack Trace : 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)

Microsoft 365 and Office | Excel | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2023-11-12T20:59:20+00:00

    I have a c# program running as a service on my windows 11 PC (for about 9 months now). But since the weekend I get this error. Error 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)).

    This is my code

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

                Microsoft.Office.Interop.Excel.Workbook xlWorkBook = xlApp.Workbooks.Open(@"C:\Dealer Limits.xlsb", ReadOnly: true);

                Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet = xlWorkBook.Worksheets["Limits"];

                xlApp.Run("LoadDataFromExcelToSQL");

    Was this answer helpful?

    2 people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2023-09-02T06:53:36+00:00

    This error message indicates that the COM class factory for the specified CLSID failed to be retrieved due to a server execution failure.

    Could you share some screenshot of your issue. It is hard to say what happen whithout enviroment at hand.

    Then we may give suggestions on it.

    Was this answer helpful?

    0 comments No comments