ALogvin
asked on
Windows Server 2003 ASP.NET Web Service getting Access Denied when running System.Diagnostics.Process
I have a ASP 2.0 .NET C# Web Service. This web service's goal is to run a command line .EXE application. To do this, I create a Process, assign it some variables, and let it rip. It works great on my local machine, but when I put it on my 2003 Web Server, it fails. I highly suspect it is a permissions issue, however I dont know a lot about IIS. Here is a code snippet:
System.Diagnostics.Process myProcess = new System.Diagnostics.Process ();
myProcess.StartInfo.FileNa me = "cmd.exe";
myProcess.StartInfo.UseShe llExecute = false;
myProcess.StartInfo.Create NoWindow = true;
myProcess.StartInfo.Redire ctStandard Error = true;
myProcess.StartInfo.Redire ctStandard Input = true;
myProcess.StartInfo.Redire ctStandard Output = true;
myProcess.StartInfo.Passwo rd = mySecure;
myProcess.Start();
myProcess.StandardInput.Au toFlush = true;
myProcess.StandardInput.Wr ite(myPath + System.Environment.NewLine );
myProcess.StandardInput.Wr ite(myComm and + System.Environment.NewLine );
myProcess.StandardInput.Wr ite("exit" + System.Environment.NewLine );
myreturn = myProcess.StandardOutput.R eadToEnd() ;
myProcess.Close();
Now at this point it doesnt matter what I am doing with this app. I changed it to CMD.EXE, and it dies at the same point: When I execute the Start() method.
Error Message:
System.ComponentModel.Win3 2Exception : Access is denied at System.Diagnostics.Process .StartWith CreateProc ess(Proces sStartInfo startInfo) at System.Diagnostics.Process .Start()
What should I do to make this work?
System.Diagnostics.Process
myProcess.StartInfo.FileNa
myProcess.StartInfo.UseShe
myProcess.StartInfo.Create
myProcess.StartInfo.Redire
myProcess.StartInfo.Redire
myProcess.StartInfo.Redire
myProcess.StartInfo.Passwo
myProcess.Start();
myProcess.StandardInput.Au
myProcess.StandardInput.Wr
myProcess.StandardInput.Wr
myProcess.StandardInput.Wr
myreturn = myProcess.StandardOutput.R
myProcess.Close();
Now at this point it doesnt matter what I am doing with this app. I changed it to CMD.EXE, and it dies at the same point: When I execute the Start() method.
Error Message:
System.ComponentModel.Win3
What should I do to make this work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.