0
当我试图从web API本地启动一个进程时,它启动成功,但是当我将它托管到IIS 7.5并尝试启动该进程时,没有响应我正进入(状态。当我试图调试安装过程到Visual Studio,开始我看到这个错误进程的BasePropertyprocess.BasePriority抛出了一个类型异常'System.InvalidOperationException'
process.BasePriority threw an Exception of Type 'System.InvalidOperationException'
我开始一个进程来启动一个CMD.EXE这里调试代码如下:
public static void Start(long campaign_id, long contact_id, string startDate, string endDate, string user)
{
try
{
//WindowStyle = ProcessWindowStyle.Hidden;
startInfo.FileName = "cmd.exe";
startInfo.WorkingDirectory = @"C:\";
startInfo.Arguments = "/c sparkclr-submit --master " + ConfigurationManager.AppSettings["SparkMaster"] + " --driver-class-path " + AppDomain.CurrentDomain.BaseDirectory + "Engine\\mysql.jar " + "--exe CmAnalyticsEngine.exe " + AppDomain.CurrentDomain.BaseDirectory + "Engine " + campaign_id + " " + contact_id + " " + startDate + " " + endDate + " " + user;
startInfo.CreateNoWindow = false;
startInfo.UseShellExecute = false;
startInfo.LoadUserProfile = true;
//startInfo.Verb = "runas";
process.StartInfo = startInfo;
process.Start();
if (!process.HasExited)
{
Console.WriteLine("process is running");
}
else
{
Console.WriteLine("process is stopped");
}
}
catch (Exception e)
{
LogWritter.WriteErrorLog(e);
}
}
当我在本地运行时,它工作正常,但在IIS上它的打印信息进程停止。
我是否需要给权限cmd.exe从IIS启动?如果是,那么该怎么做?
任何帮助将不胜感激。
感谢