User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active
 

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).

 

If you need to give access for the web server to use office automation the easiest way is to just open dcom.

 

1. In DCOMCNFG, right click on the My Computer and select properties. 
2. Choose the COM Securities tab
3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for <Machine_name>\Users.
4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for <Machine_name>\Users

You may need to add IUSR and IIS_USRS depending on your configuration

 

Also, you have to install office on the web server for this to even work at all.

Installing just o2010pia will do nothing for you.

 

If you are creating office documents within a IIS website user file permissions is going to be crucial.

I recommend creating a local user account on the web server and running your application pool under that user.

You will also want to login as that user on the web server and open the office application you plan to automate. You might get the "enter your initial" box when first opening the application and this is what is happening during automation of an office document so it errors. 

You get things like 

  Exception message: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution