locked
Error : 80070005 RRS feed

  • Question

  • User-1168805280 posted

    Hi, try to export a gridview to excel. In my class, I

    Imports Excel = Microsoft.Office.Interop.Excel



    Then, below it, I made a Sub that will export the grid to excel. Like this:

    Dim oApp As New Excel.Application
    
            oApp.Visible = True
            oApp.UserControl = True
            Dim oldCI As System.Globalization.CultureInfo = _
                System.Threading.Thread.CurrentThread.CurrentCulture
            System.Threading.Thread.CurrentThread.CurrentCulture = _
                New System.Globalization.CultureInfo("en-US")
            oApp.Workbooks.Add()
    
            Dim xlWorkSheet As Excel.Worksheet
    
            xlWorkSheet = oApp.ActiveSheet


    When I debug my web, it's work fine, but when i run it from my IIS (localhost) I got this error :


    Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.

    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. 

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

    Source Error: 


    Line 474:        ''

    Line 475:

    Line 476:        Dim oApp As New Excel.Application



    Anybody can help me?

    Thanks.

    Thursday, March 18, 2010 12:02 PM

Answers

  • User-1739576956 posted

    Hey, this describes the issue: http://blog.crowe.co.nz/archive/2006/03/02/589.aspx

    In summary, you should check this: go to dcomcnfg -> DCOM -> Microsoft Excel (or smth like that) and check the activation and launch permissions.

    Br. Morten

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 18, 2010 3:58 PM
  • User-1168805280 posted

    Ok, I love you ........ thanks my brother ....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 20, 2010 6:21 AM

All replies

  • User-1739576956 posted

    Hey, this describes the issue: http://blog.crowe.co.nz/archive/2006/03/02/589.aspx

    In summary, you should check this: go to dcomcnfg -> DCOM -> Microsoft Excel (or smth like that) and check the activation and launch permissions.

    Br. Morten

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 18, 2010 3:58 PM
  • User-1168805280 posted

    Ok, I love you ........ thanks my brother ....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 20, 2010 6:21 AM