I have a service which copies an Excel spread sheet from a network share to a local folder. The service runs under an account which has admin rights on both the remote and local machine.
When running the service from the command line as the service admin account the file copy succeeds. However, when running the service as a windows service, the file copy fails, and does so silently.
So there are two problems;
- Why does the service behave differently between the command line and windows services, even though they are both being run under the same admin account?
- Why does the file copy fail silently when the msdn documentation suggests this is not possible?
Simplified code:
try
{
File.Copy(@"\\share\folder\file.xlsm", @"C:\temp\file.xlsm");
}
catch (Exception ex)
{
Logger.Error("error");
}