2
Answers

Server execution error while opening excel in C#

Moeed Ghori

Moeed Ghori

3y
7.3k
1

While trying to read excel file in C# console application, i am getting following 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))".

Below is the code:

using Application = Microsoft.Office.Interop.Excel.Application;
Application excelApp = null;
Microsoft.Office.Interop.Excel.Workbook excelWorkbook = null;
try
{
 excelApp = new Application { Visible = false };
}

The Error is occurring on folowing line:

excelApp = new Application { Visible = false };

I have also tried following configuration from dcom properties for excel application:

Answers (2)
0
Leon D

Leon D

498 2.7k 387 3y

Microsoft Office Interop is not recommended to be used on server side. You can use some other third party libraries like Free Spire.XLS to read excel.

 

https://www.nuget.org/packages/FreeSpire.XLS/ 

0
Shweta Lodha

Shweta Lodha

20 48.6k 4.2m 3y

Changing the security settings in your above screenshot may help you. Go to Security tab and add add the user who is trying to call the application, by clicking on Cstomize button. Doing this will help you to understand, whether it is a permmission issue or something else.