从IIS托管网站执行蝙蝠命令



这是关于从托管网站执行BAT文件的

当我尝试执行蝙蝠侠并在当地的Visual Studio中运行它时它运行完美(Localhost),但是当涉及到从托管Web(public-IP)执行(相同的项目位置)时,它会失败(控制只需通过Process.start()方法)就什么都不做。

我在这个问题上给了足够的时间,希望有一些完整的证明解决方案。我检查了事件日志,有

  • 分布式com错误(10016,10010)尝试此批量文件执行时。

据我所知,它的权限问题,我已经对REG级别(根据Appid,CLSID)进行了更改,但没有重新层。

sys:Windows 8单语言

正如我注意到的那个权限时,请尝试以下代码

System.Diagnostics.ProcessStartInfo psinfo =
   new System.Diagnostics.ProcessStartInfo(@“C:temp.bat”);
 psinfo.RedirectStandardOutput = true;
 psinfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
 psinfo.UseShellExecute = false;
 System.Diagnostics.Process lstFiles;
 lstFiles= System.Diagnostics.Process.Start(psinfo);
 System.IO.StreamReader myOutput = lstFiles.StandardOutput;
 lstFiles.WaitForExit(2000);
 if (lstFiles.HasExited)
  {
  string output = myOutput.ReadToEnd();
  this.processResults.Text = output;
 }

希望这会有所帮助。您还会检查防火墙,这可能是一个防火墙问题。因此,它与操作系统而非ASP.NET有关。

最新更新