Accessing Office Word Object Model Through ASP.NET Results in "Failed Due to the Following Error: 80070005 Access Is Denied."

Accessing Office Word object model through asp.net results in failed due to the following error: 80070005 Access is denied.

This worked for me:

  1. In the command line put DCOMCNFG
  2. Component Services -> Computers -> My Computer -> DCOM Config
  3. Find "Microsoft Word 97 - 2003 Document" (If it is missing check if your Word is also 64 bit (if your Windows is) if it is not run mmc comexp.msc /32
    instead of DCOMCNFG on step 1 as suggested by Darkseal here)
  4. Right click -> Properties
  5. Go To Tab Security and Edit the "Customize" radio buttons so that IIS_IUSRS could have rights for launch and access
  6. Go to Tab Identity and choose "The interactive user"
  7. Apply changes and try again
  8. If all this fails, go also to tab "General" and in "Authentication Level" drop down choose "None".

Retrieving the COM class factory for component with CLSID failed due to the following error: 80070005 Access is denied

  1. From the Start menu, click Run and type Dcomcnfg.exe.
  2. In Component Services, click Console root, expand Component Services, expand Computers, expand My computer,expand DCOMConfig.
  3. Search for Microsoft Word 14.0 Object Library. Click on it.
  4. Right click and select Properties.
  5. On security tab, select Customize in "Launch and Activation" section.
  6. Click edit and add identity of app pool under which you application is running.
  7. Repeat above step for "Access Permission"

Access denied to Office from ASP.Net application using microsoft.interope.word

Use the Open XML SDK instead.

The Considerations for server-side Automation of Office page states 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.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

The article describes possible alternatives to using Office automation.

How to fix '80070005 Access is denied' when accessing remote com+ object?

ServerPC and ClientPC are not in one domain, so I needed user with same login and password on both PCs.

80070005 Access is denied,when asp.net website with crystal report is deployed on dedicated server

I have the same problem on a client's windows server 2003 machine running IIS6. Their server is very locked-down compared to normal servers, and something in that locking-down is probably the problem. I haven't experienced this problem on dozens of other clients' servers. I haven't solved the problem yet but here are some steps from what I've learned so far...

First thing to do is double-check which Application Pool your app is running under, and then check which Identity the App Pool is using (e.g. Network Service or Application Pool Identity or...). This is important to ensure you're giving permissions to the right user. Don't go any further until you're sure about this.

Next check if you're using IIS Impersonation (probably you're not unless you know what it is). This is where the application pool is sort-of running under the identity of the user ... this would only be the case if you're using Windows Authentication and in the web.config you have <identity impersonate="true" />. If you are using Impersonation then probably you have to give end users all the necessary file and/or COM access. If not (as in my case) it should just be a matter of checking the permissions are right for your application pool's user or IIS users group.

Once you know the right identity for permissions, try these steps:

  • If it's a 64-bit machine check you have Enable 32-bit applications enabled for the Application Pool (or that you have the 64-bit runtime installed)
  • Check the Application Pool identity has access to the C:\Windows\Temp folder (you've mentioned you've done this but I thought I'd list it for anyone else encountering the problem).
  • Check the Application Pool identity has access to the Crystal Reports folder, e.g. C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\. You can find the folder by opening regedit.exe and navigate to HKEY_CLASSES_ROOT\CLSID\{4DB2E2BB-78E6-4AEA-BEFB-FDAAB610FD1B}\InProcServer32. Get the path from the (default) value for that registry key and check the permissions on the parent folder for that path. Try giving Full Control to the folder to the right identity to see if that fixes the problem.
  • I'm not sure if this is relevant, but possibly adding <startup useLegacyV2RuntimeActivationPolicy="true"> to the web.config might help ... it was suggested in this post relating to a different COM application having similar problems so worth a go? So you'd add this inside the tag within web.config:

    <startup useLegacyV2RuntimeActivationPolicy="true"> 
    <supportedRuntime version="v4.0"/>
    </startup>
  • Check the COM permissions on the server:

    • open Component Services from Control Panel > Administrative Tools
    • expand Component Services > Computers > My Computer then right-click > properties
    • click on the COM Security tab
    • In the Launch and Activation Permissions click on the Edit Default... button
    • Check the Launch and Activation Permissions permissions listed. If your app pool user isn't listed can try adding it with all 4 Allow permissions and retest. If that doesn't solve the problem then undo any changes.
  • If none of this has solved it then I suggest downloading Process Monitor and try to determine what it's trying to do that hits an Access Denied. This is the next step for me on the problem so if I find anything out I'll update this answer.


Related Topics



Leave a reply



Submit