I have a Windows Service with a task to run an .exe
file when its scheduled time arrives. This program has worked under all devices that I have installed my program in. The user who runs the service has all the required administrative rights.
This is the code where the program runs the .exe
file. The Log()
function writes the message in a log file.
Log("About to run the file...");
try
{
Process.Start(filePath, args);
Log("File Triggered!");
}
catch (Exception ex)
{
Log("Error.");
}
What happens is that the program works up until logging "About to run the file..." and then nothing happens and nothing is logged. This is very strange knowing the exact same program works fine in all other environments I have tested.
Is it possible that Process.Start()
silently and without an error refuses to run my .exe
file? The target .exe
file is placed in the exact same folder as the running service so that cannot be a problem.
Does the Log On user of my service lack the authority to run this file? If so, why don't we receive the "Error" message in the log? Would appreciate any help!
Update 1: The target OS is Windows 8 and I have developed my program under Windows 7.
Update 2: I tried the program on another machine running Windows 8.1 and it was working fine.