Exception calling Excel.Interop

0

I'm experiencing a production issue when opening an Excel Workbook's. The exception thrown is:

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

The event viewer error log detail is:

Log Name:      Application
Source:        ASP.NET 2.0.50727.0
Date:          01/11/2018 11:50:32 a.m.
Event ID:      1309
Task Category: Web Event
Level:         Warning
Keywords:      Classic
User:          N/A
Computer:      XXXXX
Description:
Event code: 3005 
Event message: An unhandled exception has occurred. 
Event time: 01/11/2018 11:50:32 a.m. 
Event time (UTC): 01/11/2018 02:50:32 p.m. 
Event ID: 6ab432cf79584f7a96bb12defe163827 
Event sequence: 849 
Event occurrence: 17 
Event detail code: 0 

Application information: 
    Application domain: /LM/W3SVC/1/ROOT-2-131855513563546112 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: C:\inetpub\wwwroot\Servicio\ 
    Machine name: XXXXX 

Process information: 
    Process ID: 4460 
    Process name: w3wp.exe 
    Account name: IIS APPPOOL\Servicio 

Exception information: 
    Exception type: COMException 
    Exception message: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005. 

Request information: 
    Request URL: http://servicio.honda.com.ar/xxxx.aspx 
    Request path: /xxxx.aspx 
    User host address: 10.138.204.69 
    User: XXXX.                                                                                      |XX|0                             |0|1|652 
    Is authenticated: True 
    Authentication Type: Forms 
    Thread account name: IIS APPPOOL\Servicio 

Thread information: 
    Thread ID: 15 
    Thread account name: IIS APPPOOL\Servicio 
    Is impersonating: False 
    Stack trace:    at IngresoServicio.Upload() in c:\inetpub\wwwroot\xxx\xxxx.aspx.cs:line 131
   at IngresoServicio.ImageButtonImportar_Click(Object sender, ImageClickEventArgs e) in c:\inetpub\wwwroot\xxx\xxxx.aspx.cs:line 63
   at System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
   at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

I follow this steps "Retrieving the COM class factory for component.... error: 80070005 Access is denied." (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) but get error anyway.

What am I missing please?

Best Regards

asp.net
excel
com
interop
asked on Stack Overflow Nov 1, 2018 by Jorge M

1 Answer

0

It looks like you're trying to use Excel automation on a server. This is an unsupported use case. In fact, this has been tried and failed so many times by so many people that the answer is well-known at this point -- DO NOT AUTOMATE OFFICE PRODUCTS ON A SERVER. EVER. PERIOD. That is the official answer of Microsoft and the developer community. Look into tools that can create, read or manipulate the documents as data files, such as the Open XML SDK. (If you're going to use the Open XML SDK, I highly recommend also downloading the Productivity tool when downloading the SDK.)

answered on Stack Overflow Nov 1, 2018 by Michael Gunter

User contributions licensed under CC BY-SA 3.0