In Console Application command "sw-precache" is executed and output contains the expected result, in web application after execute "proc.StandardOutput.ReadToEnd()" nothing happening! What can be the difference between WebApplication and ConsoleApplication?
Process proc = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = @"cmd.exe",
Arguments = @"/c some-command",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true,
WorkingDirectory = Path.GetFullPath(appPathDir)
}
};
proc.Start();
// To avoid deadlocks, always read the output stream first and then wait.
string output = proc.StandardOutput.ReadToEnd();
proc.WaitForExit();
Console.WriteLine("success");
Console.WriteLine(output);