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啓動?如果是,那麼該怎麼做?
任何幫助將不勝感激。
感謝