Comprehensive Guide to Resolving Excel COM Component Access Denied Error (0x80070005) in IIS

Nov 30, 2025 · Programming · 17 views · 7.8

Keywords: IIS | Excel COM | Access Denied | DCOM Configuration | ASP.NET

Abstract: This article provides an in-depth analysis of the "Access Denied" error (HRESULT: 0x80070005) encountered when calling Excel COM components from ASP.NET in IIS 6.0 environments. Through systematic configuration steps including Office installation, user permission settings, DCOM security configuration, and application pool identity adjustments, it offers a complete solution. The article also explores alternatives like Open XML SDK and explains special considerations for 64-bit Windows Server environments.

Problem Background and Error Analysis

When calling Microsoft Office Excel COM components from ASP.NET web applications, developers frequently encounter the following error:

"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))

This error typically occurs in IIS 6.0 environments, particularly on Windows Server 2008 Enterprise Edition 64-bit systems. The error code 0x80070005 indicates insufficient access permissions, preventing the system from creating an instance of the Excel COM component's class factory.

Core Configuration Steps

Resolving this issue requires systematic configuration at multiple levels:

Office Runtime Installation Verification

First, ensure that a full version of Microsoft Office Professional is installed on the server. Office 2010 or newer is recommended, as newer versions provide better COM interop support. Avoid using stripped-down or runtime versions, which may lack necessary COM component registrations.

Dedicated User Account Creation

Create a dedicated user account (e.g., ExcelUser) specifically for Excel COM operations, configured with the following properties:

Detailed DCOM Configuration Steps

Configure Excel COM component security settings through Component Services Manager:

  1. Open Control PanelAdministrative ToolsComponent Services
  2. Expand ComputersMy ComputerDCOM Config
  3. Locate and right-click Microsoft Excel Application, select Properties
  4. In the General tab, set Authentication Level to None
  5. In the Security tab, customize the following three permissions:
    • Launch and Activation Permissions: Add Everyone group and grant Local Launch and Local Activation rights
    • Access Permissions: Add Everyone group and grant Local Access rights
    • Configuration Permissions: Add Everyone group and grant Full Control rights
  6. In the Identity tab, select This User, enter the previously created ExcelUser account and password

Application Pool Configuration Optimization

IIS application pool configuration is crucial for COM component access:

Code Implementation Example

Below is an example of properly instantiating Excel objects in ASP.NET:

using excel = Microsoft.Office.Interop.Excel.Application;

namespace TestHosting
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                excel excelObj = new Microsoft.Office.Interop.Excel.Application();
                // Subsequent Excel operation code
                excelObj.Quit();
                System.Runtime.InteropServices.Marshal.ReleaseComObject(excelObj);
            }
            catch (Exception ex)
            {
                // Error handling logic
            }
        }
    }
}

Alternative Solution Considerations

Given the complexity of COM interop, consider evaluating these alternatives:

Troubleshooting and Verification

After configuration, perform the following verification steps:

  1. Manually launch Excel application to confirm the configured user account can run Excel normally
  2. Check Windows Event Viewer application logs for related error information
  3. Use Process Monitor tool to monitor file system and registry access, identifying permission issues
  4. Ensure all Excel processes are completely terminated before testing

Best Practice Recommendations

When using Excel COM components in production environments, follow these best practices:

Copyright Notice: All rights in this article are reserved by the operators of DevGex. Reasonable sharing and citation are welcome; any reproduction, excerpting, or re-publication without prior permission is prohibited.