Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, July 18, 2017 5:34 PM
I have an application that uses Word Interop
Microsoft.Office.Interop.Word.Application word = null;
word = new Microsoft.Office.Interop.Word.Application();//do something with word
It was working fine on one of our servers, however we recently got a new one. New server has Word from the Office Professional Plus 2016 installed (no other applications like Excel or others).
On the new server I CAN run this application from my account (this tells me that all components are present on the machine).
However if application is run from the service account, it gets
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
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 looks like an access issue, but I can not pinpoint which particular permission service account is missing.
Trying to debug this situation I even gave service account administrator access but it didn't solve the issue.
Any thoughts or suggestions would be greatly appreciated!
Thank you very much.
All replies (5)
Wednesday, July 19, 2017 5:53 AM
Hello,
It seems that you are doing server side automation of Office. Please visit Considerations for server-side Automation of Office:
Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.
Regards,
Celeste
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Wednesday, July 19, 2017 2:30 PM
Thank you for the answer.
Yes I know MS doesn't recommend it, however I was using Office Automation with success on many projects before, and this particular application was working on another machine.
I'm hopeful to find resolution for this issue.
Thanks!
Thursday, July 20, 2017 4:44 AM
Hello,
As the link mentioned, Microsoft does not currently recommend, and does not support.
I would suggest you use Open XML to work around.
Sorry for any inconvenience.
Regards,
Celeste
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected].
Thursday, July 20, 2017 10:50 PM
Tried this:
DCOMCNFG.exe
Component Service ->Computers->My Computer->DCOM Config->Office Licensing COM Server 16->Properties->Security->Launch and Activation Permission
This let me "Run As" But when setup on Task Scheduler it still gets the error.
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).
I keep searching...
Tuesday, July 25, 2017 7:56 AM
Hi bezpal,
Is it helpful to enable Component Service ->Computers->My Computer->DCOM Config->Office Licensing COM Server 16->Properties->Identity->The interactive user Radio?
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.