I have a windows service that is intended to do the following:
- Monitor a folder on the server for PDF files
- When file arrives, run a third party exe to convert the PDF to Excel. No text output is generated. The third party tool simply uses the input file path and generates an output excel file. No need for a window launch. No need to track sessions.
- Windows service then reads the data from the Excel, processes it, and outputs an xml into a folder.
All this works fine in debug mode. However, when I try to run the windows service on my local machine in release mode (using installutil) as a service (as opposed to in visual studio), it does not work. When I attach-to-process, I notice the cursor just hangs on waitforexit and no excel is generated. Since it works in debug but not in release mode, I suspect it's a permissions issue. Any feedback will be appreciated.
Already tried checking "Allow service to interact with desktop". Didn't help.
EDIT: correction - cursor actually hangs on exeProcess.WaitForExit()
ProcessStartInfo sInfo = new ProcessStartInfo();
sInfo.FileName = ConfigurationManager.AppSettings["FileName"];
sInfo.Arguments = GetArguments();
sInfo.UseShellExecute = false;
sInfo.CreateNoWindow = true;
sInfo.ErrorDialog = false;
sInfo.WindowStyle = ProcessWindowStyle.Hidden;
//sInfo.RedirectStandardError = true; //didn't work
//sInfo.RedirectStandardInput = true; //didn't work
//sInfo.RedirectStandardOutput = true; //didn't work
using (Process exeProcess = Process.Start(sInfo))
{
//StreamWriter inputWriter = exeProcess.StandardInput;
//StreamReader outputReader = exeProcess.StandardOutput;
//StreamReader errorReader = exeProcess.StandardError;
exeProcess.WaitForExit();
}