.Net C# web application that generates a word document from one of its web page.

In dev server we have recently upgraded the microsoft office version from 2010 to 2016. while initializing word dll running into issues (in one another environment still we have office 2010 installed and we don't see this issue, but the microsoft office upgrade from 2010 to 2016 is mandatory). So i need help to fix this issue.

using Word = Microsoft.Office.Interop.Word; .....

App wrodApp = new Word.Application(); --> this line causing the below error

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)).

Please let me know how to resolve this issue?

1

There are 1 answers

0
Eugene Astafiev On

Here is what MS states:

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.

You may consider third-party components designed for the server-side execution instead. Or, if you deal with Open XML documents only, you may consider using the Open XML SDK 2.5 for Office.