I have a strange behavior started occurring recently on Windows Server 2016/2019. I performed tests using different versions of Excel (2016, 2019, 365) and the issue happened randomly when a remote desktop session is opened on the server (some RDP initiated from some machines do not cause any issue while some others led to the application not working).
The code opening excel is pretty simple and was working for couple of years without any issue:
string filePath = @"C:\excelFilePath.xlsx";
Application excelApp = new Application();
excelApp.Workbooks.Open(filePath , true, true);
When it failed we got the following exception:
The remote procedure call failed. (Exception from HRESULT: 0x800706BE) System.Runtime.InteropServices.COMException (0x800706BE): The remote procedure call failed. (Exception from HRESULT: 0x800706BE) at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)
For the conflicting RDP i noticed that rdpinput.exe process was activated while with non-conflicting one there no trace of activation of the that process. If no RDP session is opened on that server, everything works fine.
Any idea how to solve this issue ? We still need to be able to RDP the server.
Thank you!