使用 System.Diagnostics.Process 时访问被拒绝
我正在尝试使用 System.Diagnostics.Process 从命令行在 ASP.NET 应用程序中使用非托管 ImageMagick 库。基本上,用户会将 .eps 文件上传到网站,然后我将运行命令行命令将其转换为 .jpg。这是我用来尝试运行命令的代码:
Dim proc As New System.Diagnostics.Process
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.RedirectStandardError = True
proc.StartInfo.FileName = "C:\Program Files (x86)\ImageMagick-6.6.1-Q16\convert.exe"
proc.StartInfo.UseShellExecute = False
proc.StartInfo.Arguments = String.Format("{0} {1}", Server.MapPath("~/logo/test.eps"), _
Server.MapPath("~/certificates/temp/test-1234.jpg"))
proc.StartInfo.CreateNoWindow = True
proc.Start()
我能够在我们的开发 Win 2k3 服务器上运行此代码,但不能在我们的生产 Win 2k3 服务器上运行。我收到错误“System.ComponentModel.Win32Exception:访问被拒绝”。两台服务器之间的主要区别是产品是64位的并且运行Plesk来管理多个域。我尝试将权限 asp.net 用户添加到 ImageMagick 目录。 PS 管理员说,就 Plesk 而言,它与我使用 FPE 访问 VS 中的站点所用的帐户相同。
有谁知道我可以做什么才能允许此过程在我的生产服务器上运行?
谢谢,
迈克
I am trying to use the unmanaged ImageMagick library in my ASP.NET application from the command line using System.Diagnostics.Process. Basically, users will upload an .eps file to the site, and then I will run the command line command to convert it into .jpg. This is the code I'm using to try and run the command:
Dim proc As New System.Diagnostics.Process
proc.StartInfo.RedirectStandardOutput = True
proc.StartInfo.RedirectStandardError = True
proc.StartInfo.FileName = "C:\Program Files (x86)\ImageMagick-6.6.1-Q16\convert.exe"
proc.StartInfo.UseShellExecute = False
proc.StartInfo.Arguments = String.Format("{0} {1}", Server.MapPath("~/logo/test.eps"), _
Server.MapPath("~/certificates/temp/test-1234.jpg"))
proc.StartInfo.CreateNoWindow = True
proc.Start()
I am able to run this code just fine on our development Win 2k3 server, but not on our production Win 2k3 Server. I get the error "System.ComponentModel.Win32Exception: Access is denied". The main between the two servers is that the production is 64-bit and runs Plesk to manage multiple domains. I've tried adding rights asp.net user to the ImageMagick directory. The PS Admin says that in the case of Plesk, it's the same account that I use to access the site in VS using FPE.
Does anyone know what I might do in order to allow this process to run on my production server?
Thanks,
Mike
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要确保实际的应用程序池身份被授予启动应用程序的权限。我相信当您在服务器上设置每个域时,plesk 会为每个域创建一个特定的用户。
您可以使用 IIS 管理器进行验证,以查看它所在的应用程序池和身份。
我的猜测是您根本没有为正确的用户授予权限。
You need to make sure that the actual application pool identity is given the rights to start the application. I believe that plesk creates a specific user for each domain as you set it up on the server.
You can validate this using the IIS manager to see what application pool and identity it is in.
My guess is that you simply do not have the permissions granted for the correct user.