Salehe
Salehe

Reputation: 13

Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE) in c# when making excel application

i use c# to make macro in excel but in this line of my code

oExcel = new Excel.Application()

i have this error

Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE))

I use IIS 7 , visual studio2013(use asp.net) and windows server 2008

i try this ways but not work for me : Run>ComponentService>Computers>My Computers >DCOM Config> Microsoft Excel Application > Right click >Properties >security tab > give accesse of everyone to full contol

is it about permission of windows or not ?

Upvotes: 0

Views: 3173

Answers (1)

Bradley Smith
Bradley Smith

Reputation: 13621

From Microsoft's support page "Considerations for server-side Automation of Office":

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.

The above article also specifically names the error you encountered as being among those which are likely to occur when trying to use Automation in a server-side application.

Excel Automation really shouldn't be used in a web application at all. The current recommendation is to use the OpenXML SDK instead.

Upvotes: 2

Related Questions