80080005 Server execution failed when using Word Automation

0

I have a .Net C# application that manipulates Word documents.

I am using Microsoft.Office.Interop.Word.dll, part of Office 2010, product version 14.0.xxx. Invoking:

using Microsoft.Office.Interop.Word;

...

Application app = new Application();

causes the following 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 also noticed that when this error is generated, an instance of WINWORD.EXE is created and hangs, but the file is associated to Office 365, product version 16.0.xxx.

I am assuming that the (at least one) source of the error is the incompatibility between the .dll I'm using and the version of Word installed on my development machine.

QUESTION

Is it possible to perform office automation without having Microsoft Office installed on the server?

c#
automation
ms-office

2 Answers

3

You don't need to install MS on your Server to use Office Automation!.

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.

answered on Stack Overflow Nov 6, 2019 by Esmaeli
1

Is it possible to perform office automation without having Microsoft Office installed on the server?

No, it is not possible. Instead, you may consider using the Open XML SDK if you deal with open XML documents only. Otherwise, you may consider using any third-party components designed for the server-side execution, for example, Aspose.

The Considerations for server-side Automation of Office article states the following:

All current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended.

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.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

answered on Stack Overflow Nov 6, 2019 by Eugene Astafiev • edited Jun 20, 2020 by Community

User contributions licensed under CC BY-SA 3.0