locked
Excel file in C#.NET80070005 Access is denied RRS feed

  • Question

  • Hi All,

    I have looked for the error in other forums but nothing seems to be working for me and so I had to post it again with my scenario. Here is the issue what I am facing -We are using Microsoft.Office.Interop.Excel version 15.0.0.0 for generating Excel file in C#.NET with .NET framework 4.0. The Excel file has generated successfully when in development mode.

    I have published the site and deployed in IIS 7, we are getting the below error during Excel file generation,

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

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: 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)). ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6 and IIS 7, and the configured application pool identity on IIS 7.5) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET access to a file, right-click the file in File Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.

    Steps taken to resolve:

    RunàDCOMCNFG à Component services à Computers à My Computer à DCOM config,

    Microsoft Excel Application

    Under Security tab,

    1. Provided full permission to local & remote launch and Activation for the users IUSR, IIS_IUSRS, NETWORK SERVICES  
    2. Provided full access to IIS_IUSRS, NETWORK SERVICES 
    3. Under configuration permission, provided complete permission to the users IUSR, IIS_IUSRS, NETWORK SERVICES  

    But issue still persists.

    Any suggestion or advice would be appreciated.

    Thanks!

    • Moved by CoolDadTx Friday, November 20, 2015 2:53 PM Wrong forums
    Friday, November 20, 2015 10:23 AM

Answers

  • IIS has its own official forum that you can refer to for your case, for a better assistance. IIS permission cases are not discussed here:

    https://forums.iis.net/


    Fouad Roumieh

    • Proposed as answer by Just Karl Friday, November 20, 2015 11:52 PM
    • Marked as answer by Just Karl Friday, December 11, 2015 11:23 PM
    Friday, November 20, 2015 10:58 AM

All replies

  • IIS has its own official forum that you can refer to for your case, for a better assistance. IIS permission cases are not discussed here:

    https://forums.iis.net/


    Fouad Roumieh

    • Proposed as answer by Just Karl Friday, November 20, 2015 11:52 PM
    • Marked as answer by Just Karl Friday, December 11, 2015 11:23 PM
    Friday, November 20, 2015 10:58 AM
  • Thanks for your guidance.
    Friday, November 20, 2015 2:00 PM
  • Hello,

    You could also ask in Microsoft's ASP.Net C# forum:

    http://forums.asp.net/37.aspx/1?C+

    As Microsoft's ASP.Net forums are on a different platform, we cannot move the question for you.

    Be prepared to show some code no matter where you post.

    For what it's worth I have no problem opening csv files from a network share, if that's what you are trying to do.

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join('6D73646E5F6B61726C406F75746C6F6F6B2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    Friday, November 20, 2015 11:54 PM