我需要从我的asp.net网页启动简单的控制台应用程序,它使用给定的参数创建一个文件。这是我的代码:
string filePath = Server.MapPath(@"~/Patcher/TestPatcher.exe");
System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(filePath , "-sn:123456789123456 -upd -fn:test.hd");
info.UseShellExecute = false;
info.RedirectStandardOutput = true;
System.Diagnostics.Process p = System.Diagnostics.Process.Start(info);
p.WaitForExit(25000);
// Display the output
string str = p.StandardOutput.ReadToEnd();
问题是程序没有创建任何文件,但它确实启动 - 我在“str”中得到了一些输出。有什么建议?顺便说一句,该网站必须在共享主机上工作。
答案 0 :(得分:-2)
呀。我认为你有一个安全问题......你不能只从沙盒环境(浏览器是这样)运行一个exe。
除了您提供的代码段之外,还尝试在Web服务器上运行代码,而不是从asp.net页面运行代码。