Moeed Ghori

Moeed Ghori

  • 2.1k
  • 8
  • 371

Server execution error while opening excel in C#

Aug 9 2021 2:35 PM

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