Retrieving the COM class factory for component with CLSID failed

venkatesh padmanabhan 181 Reputation points
2022-04-26T09:30:54.523+00:00

Hi.
I am using windows server 2019 standard, 64 gb, x64 system. The visual studio version is VS 2019- 16.9.4.

I am trying to use the Interop.word.application in the console solution code . I have added the reference to microsoft.office.interop.word version 16.0 . The word version in my server is 2016.

Application wordApp = new Application();

When the line hits this, i am getting error as :
Retrieving the COM class factory for component with CLSID {GUID} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

The same code is working in different machine and i tried using a console application. How to fix this issue in server ?
Thanks

Microsoft 365 and Office Development Other
Developer technologies C#
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.