Server Word automation permissions (some answers a

2019-03-05 23:36发布

I am attempting to use word automation to count the number of pages in a word document. So far i have faced these errors:

  1. Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005.

  2. Word stuck when opening a document.

My resolution at the moment and steps i took so far are:

  1. Change registry key [HKEY_CLASSES_ROOT\AppID\WINWORD.EXE] from {A86A40B3-0008-4D41-975C-BB586C7121E3} to {00020906-0000-0000-C000-000000000046}.

  2. In DCOM config DCOMCNFG.EXE made the following changes:

    • In "Microsoft Word Application" displayed under its appID "{A86A40B3-0008-4D41-975C-BB586C7121E3}" gave user iusr_<MACHINE_NAME> local lunch permissions (only) and set identity to "The launching user".

    • In "Microsoft Office Word 97 - 2003 Document" also known by some as "Microsoft Word Document" (probably depends on word version) i gave full launch and access permission to both iusr and iwam, set Authentication level to "None", set launching user to my own admin user.

The combination of all 3 mods in section "2-b" finally made all this ordeal work and is now functioning. Using my own user for launching came as response to word getting stuck when opening a document. Setting authentication back to default results in error "1". Setting launching user back to "The launching user" results in error "2".

The current situation is that all is working but only when my user is logged on and active on the machine and i am not thrilled by the fact that i have to use my own user that is has to be logged on and that authentication is set to none.

I am writing this as an answer for those struggling as me for days to get this working and hopefully to get some answers to how i might improve on security, aka remove launching user and set back authentication, and not be logged on 24/7 to the production machine (when the site launches).

Specification of development machine:
Windows XP Pro 32bit
IIS 5.1
Classic ASP Website
COM+ C# object doing the automation.

1条回答
贪生不怕死
2楼-- · 2019-03-06 00:16

A solution to avoid having the user logged 24/7 is to impersonate the account and load the user profile programmatically (for this the account needs to a local administrator) before calling Word.

Another solution is to build a windows service that does the same.

查看更多
登录 后发表回答