Tru*_*nds 2 c# asp.net executable
我们有一个内部页面,我想用它来运行一个可更新服务器上的某些文件的可执行文件.换句话说,我不是每次需要手动运行此可执行文件时登录到服务器,而是希望从浏览器运行它.可执行文件在服务器上是自包含的,不与用户交互.
这是我的代码:
try
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.FileName = Server.MapPath(@"\iPhoneXMLCreator.exe");
p.StartInfo.WorkingDirectory = Server.MapPath(@"\");
p.StartInfo.RedirectStandardOutput = false;
p.Start();
p.WaitForExit();
lblResult.Text = "Success!";
}
catch (Exception ex)
{
lblResult.Text = "Oops, there was a problem.<br><Br>" + ex.Message;
}
Run Code Online (Sandbox Code Playgroud)
当我运行它时,该过程显示在任务管理器中,但然后在几秒钟内退出而不更新它应该的文件.没有参数可以传递,只是一个简单的可执行文件.有任何想法吗?