saranya
saranya

Reputation: 179

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040005

I am getting the below mentioned error when my web service tries to open MS word document pragmatically through my .net web 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 
{000209FF-0000-0000C000-000000000046} failed due to the following error: 80070005
Access is Denied

at the following line.

Microsoft.Office.Interop.Word.Application oWordApp = new Microsoft.Office.Interop. Word.Application();
Microsoft.Office.Interop.Word.Document oWordDoc = new Microsoft.Office.Interop.Word.Document();

I have written this code in server side. It has to open the word document template and find and replace some values and save as with different name

Im using 64-Bit system and Office 2007. Can any 1 help me to fix out the problem.

Upvotes: 2

Views: 8659

Answers (1)

user1876085
user1876085

Reputation: 103

I was just getting this error and it was solved by adjusting the permissions in the DCOM config on the server:

  1. Click Start -> Run -> dcomcnfg
  2. Expand Component Services -> Computers -> Right click My Computer -> Properties
  3. On the COM Security tab click Edit Defaults under Launch and Activate Permission
  4. Add both Network Service and IIS_IUSRS with local launch and local activation

No reboot should be needed for this. If your app pool is running under a different user, add that user instead.

Upvotes: 5

Related Questions