views:

44

answers:

1

Hi, I am getting the above mentioned error when my web service tries to open MS word document programatically through my .net webb service. When I run web service through visual studio, it works fine but when I deploy web service on IIS 7, I get the error

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

I have seen similar questions and tried their solutions on Stackoverflow, MSDN and other resources also but none of them worked for me. Most of the questions were old dating back to 2008/ 2007.

I have tried to change DCOM setting using dcomcnfg command and I have added 'Network Service', 'Network' users, also have added my own user id in 'Microsoft Word Document' component properties and given them full permission. I have also added impersonate=true property in web.config. After doing all this also I am getting error. Can anyone please help me out?

I am trying all this on MS vista 32 bit OS and Office version is Office 2003.

A: 

I'm not using a web service, but a windows service and I had the same error generated when the service called an executable that attempted to create an Excel object. I've also read many of the other resources and none of them quite worked for me. Several were very close which led me to solve the issue in the following way:

  1. I went to the server...Start..Run and ran "dcomcnfg".
  2. Navigate to Component Services...Computers...My Computer...DCOM Config...Microsoft Excel Application.
  3. Open properties and select the Identity tab.
  4. Select "The launching user" (instead of "The interactive user") radio button and click OK to close the properties dialog.

The error went away and the app produces the Excel file when the service runs.

I'm investigating if it is possible to get this working from a Windows service some other way because I'm not sure if this solution will have side effects. I will update further if I figure anything else out.

Randy Eppinger
Thanks a lot Randy. I will try this solution right away !!!
Shekhar