views:

36

answers:

1

Hello,

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.

I've been at it for days now and am getting desperate :) hope this helps some folks and that someone might be able to help me, if i forgot anything please ask.

A: 

Have you considered an alternative 3rd party library such as Aspose.Words?

Junto
Aspose.Words is 900$ and i would prefer to avoid this :)Besides there is no reason for this not to work so i don't see why i should shell the extra 900 bucks.
Legion
Indeed, but you are up against the following: "Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment." http://support.microsoft.com/kb/257757
Junto