Hi all
I have a very weird problem. I developed the application on XP/IIS5 and everything was fine. When I deployed it on W2k3 server with IIS6 I started getting long delays.
The code below runs an exe using cmd and then reads the response back in a local variable. In W2k3 there is always a 13 second delay just before calling Peek() the first time. Subsequent peeks are ok.
I have concluded that the problem is not in the code as it executes without problems on XP, it is with the W2k3/IIS6 but I can't find the solution.
Thanks
I have a very weird problem. I developed the application on XP/IIS5 and everything was fine. When I deployed it on W2k3 server with IIS6 I started getting long delays.
The code below runs an exe using cmd and then reads the response back in a local variable. In W2k3 there is always a 13 second delay just before calling Peek() the first time. Subsequent peeks are ok.
I have concluded that the problem is not in the code as it executes without problems on XP, it is with the W2k3/IIS6 but I can't find the solution.
Code:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = Environment.GetEnvironmentVariable("COMSPEC");
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.Arguments = command;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.RedirectStandardError = true;
proc.ErrorDataReceived += new DataReceivedEventHandler(ErrorHandler);
if (proc.Start())
{
Logger.Log("VersionManager.Execute", "in start");
proc.BeginErrorReadLine();
StreamReader sr = proc.StandardOutput;
char[] c = null;
[b]//There is always 13 seconds here[/b]
while (sr.Peek() >= 0)
{
c = new char[5];
sr.Read(c, 0, c.Length);
string temp = new string(c);
ret += temp;
}
proc.WaitForExit(20000);
proc.Close();
proc.Dispose();
Thanks