【发布时间】:2009-03-26 14:48:07
【问题描述】:
我有一段这样的代码:
Process proc = null;
try
{
proc = new Process();
string dir = HttpContext.Current.Server.MapPath("~/Other/");
proc.StartInfo.WorkingDirectory = dir;
p.StartInfo.FileName = "batch.bat";
p.StartInfo.CreateNoWindow = true;
p.Start();
p.WaitForExit();
}
catch (Exception e) { }
只有当我用
替换“dir”时它才会起作用string.Format(@"C:\AbsolutePathHere")
为什么?
编辑: 代码在按钮单击事件处理程序中工作。当它是预定的 Quartz.NET 作业时,它不起作用。当我有绝对路径时,它总是有效。所以我的问题可能是:如何让 Quartz.NET 和 MapPath 玩得更好?
【问题讨论】:
-
错误信息是什么?听起来它与权限有关。 “~/Other/”映射到什么?