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?
Issue has been resolved. Seems I had a weird issue with my Office license.
Had to do the below steps as well:
User contributions licensed under CC BY-SA 3.0