[英]I want to run .exe or bat file in C# asp.net (mvc)
以下是我使用过的不同代码,但我需要执行ETL或批处理文件,并通过查看页面链接到了按钮dashbord,但是我无法执行或运行文件,请在同一位置建议我
public ActionResult RunETL(){
try
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo = new System.Diagnostics.ProcessStartInfo(@"D:\Jobs\Execute");
p.Start();
//Process p = new Process();
//// Redirect the output stream of the child process.
//p.StartInfo.UseShellExecute = false;
//p.StartInfo.RedirectStandardOutput = true;
////p.StartInfo.FileName = @"D:\Jobs\Execute";
//p.Start();
//// Do not wait for the child process to exit before
//// reading to the end of its redirected stream.
//p.WaitForExit();
//// Read the output stream first and then wait.
//string output = p.StandardOutput.ReadToEnd();
//p.WaitForExit();
//Response.Write("Done");
////ViewBag.Result = "ETL Running";
}
catch (Exception ex)
{
//ViewBag.Result = ex.Message;
}
return RedirectToAction("Home");
}
查看用于运行Web应用程序的应用程序池标识。
它应该在批处理文件的位置具有执行权。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.