我使用下面的代碼將參數傳遞到過程例外:字符串文件名太長(處理)
ProcessStartInfo StartInfo = new ProcessStartInfo();
StartInfo.FileName = HttpContext.Current.Server.MapPath(@"\highcharts\phantomjs.exe");
StartInfo.Arguments = HttpContext.Current.Server.MapPath(@"\highcharts\highcharts-convert.js");
StartInfo.Arguments += @" -outfile " + path + @"\chart" + templateData[i].ReportTemplateChartId + ".png -width 800 -infile " + chartoptions1;
StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
StartInfo.CreateNoWindow = false;
在chartoptions1
我使用JSON字符串,但它會引發異常說字符串文件名太長了,所以我創建了一個文本文件並試圖通過它,但圖表圖像沒有生成。
嘗試用'StartInfo.UseShellExecute = TRUE;'你也可以設置'StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath (@「\ highcharts」);'然後'StartInfo.FileName =「phantomjs.exe」;默認情況下爲' – Damith
StartInfo.UseShellExecute = true;我們需要設置StartInfo.WorkingDirectory = HttpContext.Current.Server.MapPath(@「\ highcharts」); 當我們沒有確切的路徑 –