Server Word automation permissions (some answers and some questions)

余生颓废 提交于 2019-12-02 18:51:41

问题


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:


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.



来源:https://stackoverflow.com/questions/3863012/server-word-automation-permissions-some-answers-and-some-questions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!