[英]launch console application from asp.net page on shared hosting
i need to launch simple console application from my asp.net webpage, that creates a file using given parameters.我需要从我的 asp.net 网页启动简单的控制台应用程序,它使用给定的参数创建一个文件。 hereis my code:
这是我的代码:
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();
problem is that program doesnt create any file, but it does launch - i got some output in "str".问题是该程序没有创建任何文件,但它确实启动了 - 我在“str”中有一些 output。 any suggestions?
有什么建议么? and btw, that website must work on shared hosting.
顺便说一句,该网站必须在共享主机上运行。
Yeah.是的。 I think you have a security issue there... you can't just run an exe from a sandboxed environment (which the browser is).
我认为你有一个安全问题......你不能只从沙盒环境(浏览器是)运行 exe。
Besides the code snippet you provided, is trying to run code on the webserver, not on from the asp.net page.除了您提供的代码片段外,还尝试在网络服务器上运行代码,而不是从 asp.net 页面上运行代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.