我想我在这里有一个安全问题,但似乎无法绕过它。 我使用名为“MyAppPool”的应用程序池运行IIS 7.5。 然后,我从C:\ DWF中读取C#代码PDFCreator.exe的程序,然后写入C:\ DWF \ DWF.PDF。
我给了IIS AppPool \ MyAppPool完整的权限给PDFCreator.exe以及C:\ DWF目录。 当C#创build进程并调用PDFCreator.exe时,它只是启动一个显示MyAppPool作为所有者的进程,但从不打开该应用程序。
任何人都可以在任何与安全有关的问题上ch I我可能会失踪?
ProcessStartInfo processStartInfo = new ProcessStartInfo(@"c:\program files (x86)\pdfcreator\pdfcreator.exe"); processStartInfo.Arguments = @"/PF""c:\dwf\dwf.dwf"" /NoStart"; processStartInfo.RedirectStandardInput = true; processStartInfo.RedirectStandardOutput = true; processStartInfo.RedirectStandardError = true; processStartInfo.UseShellExecute = false; Process process = Process.Start(processStartInfo); // Read the output stream first and then wait string output = process.StandardOutput.ReadToEnd(); string errors = process.StandardError.ReadToEnd(); Response.Write(output + errors);
这是一个IIS应用程序的最佳devise。
桌面应用交互式运行。
IIS应用程序作为服务运行 – 不向用户显示用户界面。
你基本上使用IIS来启动一些后台处理任务(因为没有GUI可见),认为他们是前台处理任务。
你在评论中提到的那种“狡猾”,正是你为什么会遇到问题的原因。 只要选一个句子:
“这个应用程序然后使用PDFCreator的打印机驱动程序打印到PDF文件,并将其保存到桌面。”
在IIS AppPool用户的情况下,桌面在哪里?
您可以尝试使用特定的用户帐户(不是IIS AppPool \ ThisIsAVirtualAccount虚拟应用程序池标识帐户),为其提供特定的configuration文件,并将“加载用户configuration文件”设置为True(应用程序池属性)以确保configuration文件文件夹打印机驱动程序 )可用于该用户。
但是,这些都是在IIS框的背景中发生的,如果应用程序决定popup一个错误对话框,就是这样,直到框重新启动。 就像我说的那样,并不理想。