0

I'm trying to edit a Word document programmatically. However, when I debug and first try to create the Word.Application, I get

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 see that Word.Interop isn't supported anymore, so I started using NetOffice, but nothing changed, so perhaps I'm not altering the underlying functionality.

I have tried many DCOM configurations and am running my Visual Studio instance as Administrator, but nothing changes. Currently Authentication Level is None, I specify "This user" and am using an account with all the Security permissions. I've also tried the interactive user and the launching user previously. I've never had trouble with the debugger before, just once it was deployed on the server, so this is confusing to me.

I'm running Windows 8.1 (64-bit) and Office 2013 (32-bit). I'd appreciate any ideas. And does NetOffice matter at all for this problem? Thank you.

erosebe
  • 927
  • 3
  • 16
  • 31
  • I think you can get more informations if you look into the Event Viewer – Malick Aug 04 '17 at 17:30
  • In Window's System logs I'm seeing Event ID 10010, the server did not register with DCOM within the required timeout. Does that give you any ideas? I'm googling but so far nothing has had an effect. I'm not an Event Viewer master. Is there somewhere else in there I should look? – erosebe Aug 04 '17 at 19:15
  • it seems like a general error message. If it only appears in debug mode you can try to place your debug break after the first call to Word.Application and see if it works, maybe that the debug mode is too slow regarding the maximum waiting time (timeout) of the client. I have no others ideas sorry. – Malick Aug 05 '17 at 11:16

1 Answers1

0

See You may receive an "Error code 80080005 -- server execution failed." error message when you start many COM+ applications.

Anyway, 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. Read more about that in the Considerations for server-side Automation of Office article.

Consider using Open XML SDK if you deal with open XML documents only, see Welcome to the Open XML SDK 2.5 for Office for more information. Or just try to use any third-party components components designed for the server-side execution.

P.S. NetOffice will not help you to avoid such issues because it is based on the COM Automation technology.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45