I am trying to execute a batch file in C# web service. I am sure that the batch file has no problem. The problem I am facing is that the batch file will be executed only in debugging mode. It won't produce error nor being executed when I connect with the client machine. I am sure that there is nothing wrong with the connection since I can successfully send something from client to web service.
Here is the code:
try
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "C:\\mybatch.bat";
proc.StartInfo.UseShellExecute = true;
proc.Start();
}
catch (Exception e)
{
return e.ToString();
}
Visual Studio is running under administrator mode, but cmd.exe is running under (myUser) mode, but I have granted full access to every user. I don't know if this is a problem or not. If not, should I add something to the code? :(
Please tell me the possible causes of the problem and the way to solve.