Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed - 80080005

3

I am using Interop to open an instance of Excel to retrieve some data. However the following line:

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

is giving this error:

System.Runtime.InteropServices.COMException
  HResult=0x80080005
  Message=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)).
  Source=mscorlib
  StackTrace:
   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)

This was working before Office was updated to Office Pro Plus. On other machines this was solved by changing the Identity to Interactive User from the DCOM Config.

However I was unable to make it work, tried several other solutions (changed permissions etc.) but none seemed to work.

Did someone encounter this issue and managed to figure it out, please?

c#
com-interop
excel-interop
asked on Stack Overflow Jan 23, 2020 by Gertrude • edited Jan 23, 2020 by BDL

1 Answer

2

Issue has been resolved. Seems I had a weird issue with my Office license.

Had to do the below steps as well:

  1. DCOM Config > Office Licensing COM Server 16. Right click > Properties
  2. In the Identity tab, update to Interactive user
  3. In the Security tab, give Local Launch permissions to the user being used as the Application Pool identity in the Launch and Activation Permissions section.
answered on Stack Overflow Jan 27, 2020 by Gertrude

User contributions licensed under CC BY-SA 3.0