Simply, I am having issues with executing a Perl script with input parameters within a C# Web Application. I have no problem executing the code from a Console application, but within my web app, I receive no response.
The code I am using is:
ProcessStartInfo cmdStartInfo = new ProcessStartInfo();
cmdStartInfo.FileName = "C:\gnu\perl.exe";
cmdStartInfo.Arguments = "run.pl --day=1 --format=2";
cmdStartInfo.RedirectStandardOutput = true;
cmdStartInfo.RedirectStandardError = true;
cmdStartInfo.RedirectStandardInput = true;
cmdStartInfo.UseShellExecute = false;
cmdStartInfo.CreateNoWindow = true;
cmdStartInfo.WorkingDirectory = TEMP_DIRECTORY;
Process cmdProcess = new Process();
cmdProcess.StartInfo = cmdStartInfo;
cmdProcess.OutputDataReceived += cmd_DataReceived;
cmdProcess.EnableRaisingEvents = true;
// Start
cmdProcess.Start();
cmdProcess.WaitForExit();
and
static void cmd_DataReceived(object sender, DataReceivedEventArgs e)
{
// Breakpoint to DEBUG here
string result = e.Data;
}
I am using IIS 7. I wonder if it is an issue in there? I am using Identity Impersonate and Windows Authentication.