MS Word C# .NET Automation in Windows Server 2016


My server is running Windows Server 2016 64-bit.

I'm encountering a problem, my ASP .NET code return the following error:

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. 
(Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

I ran my code in debug mode and find that this error occurs when the code execute the following instruction: (I'm using Microsoft.Office.Interop.Word)

Application word = new Application();

I already tried the following manipulation:

  • Open command prompt
  • Enter "DCOMCNFG"
  • Component Services --> Computer --> My Computer --> DCOM Config
  • Microsoft Word 97 - 2003 Document --> Right click "Properties"
  • "Security" tab and give "Launch and Activation Permissions" and "Access Permissions" to IUSR & IIS_IUSRS
  • "Identity" tab and check "The interactive user"
  • Give permissions to "NETWORK SERVICE"
  • In "General" tab, set "Authentication level" to None

Also this one:

  • Create "Desktop" folder in "C:\Windows\SysWOW64\config\systemprofile\"

None of the above manipulation worked..

In Windows Server 2008 R2, the DCOMCNFG operation was enough to make the my whole code to work but it seems that Windows Server 2016 tighten the security or something...

I have installed MS Office 2016 without activating it (it wasn't necessary last time..)

Can't find the solution to this problem, any idea?

Best regards
asked on Stack Overflow Jan 15, 2020 by Irchad

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0