Reputation: 101
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?
Upvotes: 6
Views: 19029
Reputation: 5803
The RBAC way of solving this problem is to use the local Distributed COM Users
group to grant permissions. This is superior to messing with dcomcnfg.exe
because it's the modern solution offered by Microsoft.
Be sure to grant permissions using an AD security group that contains the users who should be allowed this permission instead of adding users directly to a group on a local machine.
Upvotes: 0
Reputation: 101
Issue has been resolved. Seems I had a weird issue with my Office license.
Had to do the below steps as well:
Upvotes: 4