1
votes

I try to open word like following:

Word.Application app = new Word.Application();
app.Visible = true;
Console.WriteLine($"Visible {app.Visible}");

When running this code on my development machine (Windows 10, Office 365), Word appears (as expected) and output is:

Visible: true

When running this code on the production machine (Windows Server 2019, Word 2019), Word does not appear and output is:

Visible: false

There must be some issue on the production machine as everything went well until a week ago.

Windows event log doesn't show anything that points to this issue. Re-installing Word didn't help. When starting Word manually, it starts normal and appears as expected.

Does anybody know how to investigate further or what the cause of this issue could be?

EDIT Whey I modify the code like this:

Word.Application app = new Word.Application();
app.Visible = true;
app.Activate(); // System.Runtime.InteropServices.COMException

... I get an Exception:

Anwendung kann nicht aktiviert werden. HRESULT:0x800A11F9

I found the following article COM Exception 0x800A11F9 - Cannot activate application but this doesn't provide a solution. HRESULT:0x800A11F9

I run the application as administrator.

1
Try re-installing word on the production machine..Soumen Mukherjee
Re-installing word didn't help.Abid
What happens when you try to start Word as an end-user on that machine?Cindy Meister
Word starts normal and appears as expected. It is only invisible when using Interop.Abid
Abid, remember to "ping" using the @ symbol, otherwise no one will see that you've answered in comments. I was curious what the answer was, so only just saw your comment ^^Cindy Meister

1 Answers

2
votes

I finally solved the issue.

Another application changed the Word security settings in dcomcnfg.

I changed the settings to the following (German / English):

  • General: Authentifizierungsebene: Keine / Authentication level: None

  • Security: choose Settings for all points and give all rights to Administrators/Remotedesktop user (the production server acts as terminal server)

  • Identity: Option Der Benutzer, der die Anwendung startet. / The user who started the application.

In dcomcnfg, Word isn't listed by name but by AppId. To find out, which AppId Word does have, I found this article which states

Look for HKEY_CLASSES_ROOT\CLSID{00020906-0000-0000-C000-000000000046}