Process p = new Process();
p.StartInfo.FileName = "cmd.exe";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.Start();
p.StandardInput.AutoFlush = true;
for (int i = 0; i < cmd.Length; i++)
{
p.StandardInput.WriteLine(cmd[i].ToString());
}
p.StandardInput.WriteLine("exit");
string strRst = p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
return strRst;
在控制台上执行成功,,放后台IIs下就不执行了,请问·怎么解决
iis理论上也是可以执行的,但是你可能看不到窗口出现,因为不在一个会话。
不知道你执行的是什么,cmd数组里面什么命令
检查下权限(iis所在的用户名,比如is_user有没有权限)和路径。