Link to home
Start Free TrialLog in
Avatar of ALogvin
ALogvinFlag for United States of America

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.FileName = "cmd.exe";
myProcess.StartInfo.UseShellExecute = false;
myProcess.StartInfo.CreateNoWindow = true;
myProcess.StartInfo.RedirectStandardError = true;
myProcess.StartInfo.RedirectStandardInput = true;
myProcess.StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo.Password = mySecure;
myProcess.Start();
myProcess.StandardInput.AutoFlush = true;
myProcess.StandardInput.Write(myPath + System.Environment.NewLine);
myProcess.StandardInput.Write(myCommand + System.Environment.NewLine);
myProcess.StandardInput.Write("exit" + System.Environment.NewLine);
myreturn = myProcess.StandardOutput.ReadToEnd();
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.Win32Exception: Access is denied at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at System.Diagnostics.Process.Start()

What should I do to make this work?
ASKER CERTIFIED SOLUTION
Avatar of Da1King
Da1King

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial