Friday, May 14, 2010

Problem with Office Automation (MS-Word) using Asp.Net 3.5 on 64 bit Windows 2008/Vista

Implementing MS-Word Automation using VSTO 3.0 works well with Windows 2008 / XP /2003 all with 32 bit versions. But these office automation Application start to fails once deployed on 64 bit machines.I am still searching for the exact reasons.However this can be termed as bug from Microsoft or not willing to update 64 bit Windows to support Office Applications. However now OpenXML is the new term which they strongly recommended for implementing office automation.

After searching on various forums I came to know that it is still possible to run office automations application on 64 bit machines(I tested on windows 2008 64 bit version). This is possible by

On Windows 2008 Server x64
Please make this folde
C:\Windows\SysWOW64\config\systemprofile\Desktop

Windows 2008 Server x86
Please make this folder
C:\Windows\System32\config\systemprofile\Desktop

There is one more solution available which talks about doing some hack in registry which I am not very comfortable at so i did'n tried that.However I am writing the it for the reference if somebody need that.

First, use regedit (from the SysWOW64 folder) to search the registry for the CLSID(s) related to the command "WINWORD.EXE /Automation" , you might find more than one of them.
(in my case this was: {000209FE-0000-0000-C000-000000000046} and {000209FF-0000-0000-C000-000000000046})
Under those keys in HKEY_CLASSES_ROOT\CLSID\, add a string value AppID = {same value as the IDs}
Then under HKEY_CLASSES_ROOT\AppID\ create a new key (folder) for each of these IDs, and inside each of them add a string value: RunAs = Interactive User
Next go to Dcomcnfg (from the SysWOW64 folder) and search for those IDs. (there might be a third ID related to Winword.exe), in my case this was {00020906-0000-0000-C000-000000000046}.


Note all those IDs, then right click on each of them, Properties, Security, and edit both the launch & access permissions to add and give Network Service and Interactive full permissions.

No comments:

Post a Comment