I have a Windows Service that runs the Excel Interop
in order to automate the execution of various macros. However, I am running in a peculiar issue when I try to run a macro which access a database using Windows Authentication...
If the macro is run through the Windows Service, the workbook is opened and the macro is execution is started but the application hangs (presumably at the data access portion).
If, however, the macro is run through the Visual Studio debugger, using the same implementation as the service (they call the same class library), it executes, saves the workbook, and closes as expected.
I'm sure this has something to do with impersonation, but I can't seem to figure it out. I have the windows service running under my user and I have also modified the default COM properties in the Component Services to Impersonate
instead of the default Identify
.
Any help would be greatly appreciated, as it would be preferred to run as a windows service and not a console application.