由于代码权限错误,在windows服务器2003和ii6中执行进程
本文关键字:2003 服务器 windows ii6 进程 执行 于代码 代码 错误 权限 | 更新日期: 2023-09-27 18:30:07
我在从测试服务器执行进程时遇到问题。在使用windows XP和iis5.1的本地主机上,我更改了machine.config文件,使其具有-行
然后,我更改了iis的登录名,以本地系统帐户的身份登录,并允许服务器与桌面交互。这解决了我在xp中从代码执行进程的问题。
在windows服务器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();
}
默认情况下,IIS用户帐户具有拒绝权限。请尝试将其删除,并确保您对IIS运行应用程序池所使用的帐户具有写入权限。我相信这是网络服务帐户。