开发者

Server Word automation permissions (some answers and some questions)

开发者 https://www.devze.com 2023-01-18 15:18 出处:网络
I am attempt开发者_如何学运维ing to use word automation to count the number of pages in a word document.

I am attempt开发者_如何学运维ing 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号