I have a service that data logs devices and records the info to a SQL Server. Each night at a random time after midnight I export out multiple excel documents to temp files then upload them to SharePoint. If I run the service code normally (by copying and pasting it to a form app for testing) the export work as expected. But when the service runs it I get a "The remote procedure call failed. (Exception from HRESULT: 0x800706BE)".
Is this a limitation of running the interops as a service? I can't see anything else that it could be since the code does work normally in a form app.
Couple things I have found online that did not help:
IO.Path.GetTempFileName
I switched over to ClosedXML to generate the Excel file without using Office Interop and now everything works when running as a Service.