Process fails to run on server

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I have been trying for quite a while to get this code running

FileStream file
StreamWriter fileWriter;
string programName,pscoastArgs,programName2,psxyArgs
string pscoastOutput,psxyOutput
programName = @"c:\gmt\bin\pscoast.exe"
pscoastArgs = @"-Jq-95/1:52000000 -R-130/-50/10/50 -B10g5f2.5 -G210/180/140 \"
pscoastArgs += @" -I1/1/0/0/255 -K -N1 -N2 -P -S0/0/255 -W2/0/0/255 > E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps"

ProcessStartInfo pscoastInfo = new ProcessStartInfo()
pscoastInfo.FileName = programName
pscoastInfo.Arguments = pscoastArgs
pscoastInfo.UseShellExecute = false
pscoastInfo.RedirectStandardOutput = true

// This first process creates the map where data will b
// overlaye
Process pscoast = new Process()
pscoast.StartInfo = pscoastInfo
pscoast.Start();

pscoastOutput = pscoast.StandardOutput.ReadToEnd()
pscoast.WaitForExit()

// Write process output to a fil
file = new FileStream(@"E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps",FileMode.Create,FileAccess.Write)
fileWriter = new StreamWriter(file)
fileWriter.Write(pscoastOutput)
fileWriter.Close()

// Second process uses gravity dat
// and overlays over previously created ma
programName2 = @"c:\gmt\bin\psxy.exe"
psxyArgs = @"-R -Jq -O E:\paces_datarep\www.paces\htdocs\gdrp\temp\gravitytest.dat -G0/255/255 -Sc0.05c >> E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps"

ProcessStartInfo psxyInfo = new ProcessStartInfo()
psxyInfo.FileName = programName2
psxyInfo.Arguments = psxyArgs
psxyInfo.UseShellExecute = false
psxyInfo.RedirectStandardOutput = true

Process psxy = new Process()
psxy.StartInfo = psxyInfo
psxy.Start()

psxyOutput = psxy.StandardOutput.ReadToEnd()
psxy.WaitForExit()

file = new FileStream(@"E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps",FileMode.Append,FileAccess.Write)
fileWriter = new StreamWriter(file)
fileWriter.Write(psxyOutput)
fileWriter.Close()

this code is trying to create a map and overlay some data over it. The first process (i.e. pscoast.exe) creates a poscript map and the second (i.e. psxy.exe) overlays some data over the created map. I have this code running on an aspx page, it seems to work fine in the localhost but when I put it on the server the second process fails to produce the appropriate output.
I have tried different configurations to the process model on the machine.config file, such as running in MACHINE, SYSTEM, ASPNET... all this fails. I have also given the appropriate permissions to the IWAM, IUSR, and ASPNET accounts to the folder where I'm writing the file. If anyone can help I'd appreciate it

Thanks in advance
Jorge Rasillo
 
Jorge,

What is the exception that is being thrown? Can you turn on the debug
information? From what you indicated (the fact that it can be run on local
host, but not on the machine you distribute to), it sounds like a rights
issue.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)


Jorge said:
Hi,
I have been trying for quite a while to get this code running:

FileStream file;
StreamWriter fileWriter;
string programName,pscoastArgs,programName2,psxyArgs;
string pscoastOutput,psxyOutput;
programName = @"c:\gmt\bin\pscoast.exe";
pscoastArgs =
@"-Jq-95/1:52000000 -R-130/-50/10/50 -B10g5f2.5 -G210/180/140 \";
pscoastArgs += @" -I1/1/0/0/255 -K -N1 -N2 -P -S0/0/255 -W2/0/0/255 > E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps";

ProcessStartInfo pscoastInfo = new ProcessStartInfo();
pscoastInfo.FileName = programName;
pscoastInfo.Arguments = pscoastArgs;
pscoastInfo.UseShellExecute = false;
pscoastInfo.RedirectStandardOutput = true;

// This first process creates the map where data will be
// overlayed
Process pscoast = new Process();
pscoast.StartInfo = pscoastInfo;
pscoast.Start();

pscoastOutput = pscoast.StandardOutput.ReadToEnd();
pscoast.WaitForExit();

// Write process output to a file
file = new FileStream(@"E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps",FileMode.Cr
eate,FileAccess.Write);
fileWriter = new StreamWriter(file);
fileWriter.Write(pscoastOutput);
fileWriter.Close();

// Second process uses gravity data
// and overlays over previously created map
programName2 = @"c:\gmt\bin\psxy.exe";
psxyArgs = @"-R -Jq -O
E:\paces_datarep\www.paces\htdocs\gdrp\temp\gravitytest.dat -G0/255/255 -Sc0
..05c >> E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps";
ProcessStartInfo psxyInfo = new ProcessStartInfo();
psxyInfo.FileName = programName2;
psxyInfo.Arguments = psxyArgs;
psxyInfo.UseShellExecute = false;
psxyInfo.RedirectStandardOutput = true;

Process psxy = new Process();
psxy.StartInfo = psxyInfo;
psxy.Start();

psxyOutput = psxy.StandardOutput.ReadToEnd();
psxy.WaitForExit();

file = new FileStream(@"E:\paces_datarep\www.paces\htdocs\gdrp\temp\out.ps",FileMode.Ap
pend,FileAccess.Write);
fileWriter = new StreamWriter(file);
fileWriter.Write(psxyOutput);
fileWriter.Close();

this code is trying to create a map and overlay some data over it. The
first process (i.e. pscoast.exe) creates a poscript map and the second (i.e.
psxy.exe) overlays some data over the created map. I have this code running
on an aspx page, it seems to work fine in the localhost but when I put it on
the server the second process fails to produce the appropriate output.
I have tried different configurations to the process model on the
machine.config file, such as running in MACHINE, SYSTEM, ASPNET... all this
fails. I have also given the appropriate permissions to the IWAM, IUSR, and
ASPNET accounts to the folder where I'm writing the file. If anyone can help
I'd appreciate it
 
Back
Top