Excel Interop from Windows Service crash in EXCEL.EXE, Version: 16.0.4966.1000, Moduls: oart.dll, Version: 16.0.4900.1000

0

Please don't comment, that Interop mode from Windows Service is not supported, I know that. :-)

I have an Excel file with tables and charts. It runs for several years under Windows Server 2012R2 with Excel 2003 as Windows service in Interop mode without any problems.

After changing to Windows Server 2019 and Excel 2016 it was no longer possible to open this file with the following code:

Application excelApp = new Application();
Workbooks  workBooks = excelApp.Workbooks;
workBook = workBooks.Open(<Path To Excel-File>, 0, false, 5,
     Missing.Value, Missing.Value, true, XlPlatform.xlWindows, "\t", true, false, 0, true);

It results inside my error handling in:

System.Runtime.InteropServices.COMException (0x80010105): The server threw an exception. 
(Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))

and the event log shows:

Name der fehlerhaften Anwendung: EXCEL.EXE, Version: 16.0.4966.1000, Zeitstempel: 0x5e205905
Name des fehlerhaften Moduls: oart.dll, Version: 16.0.4900.1000, Zeitstempel: 0x5d53033a
Ausnahmecode: 0xc0000005
Fehleroffset: 0x0006e67e
ID des fehlerhaften Prozesses: 0x1a38
Startzeit der fehlerhaften Anwendung: 0x01d5e64d380ea691
Pfad der fehlerhaften Anwendung: C:\Program Files (x86)\Microsoft Office\Office16\EXCEL.EXE
Pfad des fehlerhaften Moduls: C:\Program Files (x86)\Microsoft Office\Office16\oart.dll
Berichtskennung: b6eee871-9dca-4ddc-8d4b-cdd9f58f871b
excel
windows
service
automation
interop
asked on Stack Overflow Feb 18, 2020 by FlowOverStack

1 Answer

0

After hours of testing with my file I craeted a new Excel file and it was no problem to open it and read or write data to cells. Than I deleted more and more tables and charts from my file and finally I found the crash reason:

Is there any embedded image in any chart or table than it is not possible to open the file with Interop from Windows Service.

It was at no time a problem to open the file (with inside images) with the same code using a command line Application.

But it is possible to place images in header or footer. That's no problem. Crazy.

answered on Stack Overflow Feb 18, 2020 by FlowOverStack

User contributions licensed under CC BY-SA 3.0