0
從我們的測試服務器執行進程時出現問題。使用Windows XP和IIS5.1我的本地主機,我改變了machine.config文件有行 -在代碼中執行windows server 2003和ii6中的進程 - 權限錯誤
我再改登錄IIS以登錄本地系統帳戶,並允許服務器進行交互桌面。這解決了我在執行xp代碼的過程中遇到的問題。
當在windows server 2003上使用相同的方法(使用iis6隔離模式)時,該進程不會被執行。
這裏是執行過程中的代碼(我已經測試的輸入通過命令行到iecapt併產生圖像) -
public static void GenerateImageToDisk(string ieCaptPath, string url, string path, int delay)
{
url = FixUrl(url);
ieCaptPath = FixPath(ieCaptPath);
string arguments = @"--url=""{0}"" --out=""{1}"" --min-width=0 --delay={2}";
arguments = string.Format(arguments, url, path, delay);
ProcessStartInfo ieCaptProcessStartInfo = new ProcessStartInfo(ieCaptPath + "IECapt.exe");
ieCaptProcessStartInfo.RedirectStandardOutput = true;
ieCaptProcessStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ieCaptProcessStartInfo.UseShellExecute = false;
ieCaptProcessStartInfo.Arguments = arguments;
ieCaptProcessStartInfo.WorkingDirectory = ieCaptPath;
Process ieCaptProcess = Process.Start(ieCaptProcessStartInfo);
ieCaptProcess.WaitForExit(600000);
ieCaptProcess.Close();
}