【发布时间】:2015-03-30 11:16:54
【问题描述】:
环境:.Net 2.0, Windows 2003, 64bit
我正在尝试将网站从旧服务器移动到新服务器,移动代码后以下代码不再工作:
System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo("cmd.exe");
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;
// Start the process
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
System.IO.StreamReader strm = proc.StandardError;
System.IO.StreamReader sOut = proc.StandardOutput;
// Attach the in for writing
System.IO.StreamWriter sIn = proc.StandardInput;
sIn.WriteLine(exec);
strm.Close();
sIn.WriteLine("EXIT");
proc.Close();
// Read the sOut to a string.
string results = sOut.ReadToEnd().Trim();
// Close the io Streams;
sIn.Close();
sOut.Close();
似乎系统不允许运行任何.exe。该代码在以前的服务器上正常工作,所以我猜这是某些类型的系统配置问题。我在这里发现了类似的问题:Foo.cmd won't output lines in process (on website)
但我不明白“创建具有执行批处理脚本权限的新用户并选择该用户作为 IIS 中的 AppPool 用户”部分。我知道如何创建新用户,但无法弄清楚授予用户执行 .exe 或批处理文件的权限的方式。
任何建议都会有所帮助。
谢谢,
【问题讨论】:
-
您看到的确切错误信息是什么?
-
我没有看到任何错误消息。什么都没发生
标签: c# asp.net .net windows-server-2003 ashx