我在我的asp.net网站上创建了一个批处理文件,它在本地系统中工作没有任何问题。在我将其上传到网站的服务器(共享服务器)后,它在远程环境中无法工作。
下面是我收到的错误的屏幕截图

这是我用来在服务器上测试运行批处理的代码。
string path = Server.MapPath("~/SourceCode/Jsil");
Response.Write(path+"<br>");
string batpath=Server.MapPath("~/Dir.bat");
string framework = Server.MapPath("~/SourceCode/v4.0.30319");
string vscompiler = @"\csc.exe /t:exe /r:JSIL.dll;JSIL.Meta.dll Program.cs";
string full = framework + vscompiler;
Response.Write(full);
StreamWriter file = new StreamWriter(batpath);
file.WriteLine("G:");
file.WriteLine("cd " + path);
file.Write(full);
file.Close();
//Excecute bat file
System.Diagnostics.Process compile = new System.Diagnostics.Process();
compile.StartInfo = new ProcessStartInfo(batpath);
compile.Start();
compile.Close();发布于 2015-01-08 15:00:52
这可能是一个简单的权限问题。应用程序用户可能在服务器框中没有execute权限。您需要与系统管理员联系,并要求他为服务器中的IIS应用程序池用户提供执行权限。
https://stackoverflow.com/questions/27032371
复制相似问题