使用System.Diagnostics.Process时访问被拒绝 [英] Access Denied while using System.Diagnostics.Process

查看:200
本文介绍了使用System.Diagnostics.Process时访问被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用System.Diagnostics.Process从命令行在ASP.NET应用程序中使用非托管ImageMagick库.基本上,用户会将.eps文件上传到站点,然后运行命令行命令将其转换为.jpg.这是我用来尝试运行命令的代码:

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()

我能够在我们开发的Win 2k3服务器上正常运行此代码,但不能在我们的生产Win 2k3服务器上运行此代码.我收到错误"System.ComponentModel.Win32Exception:访问被拒绝".两台服务器之间的主要区别是生产是64位的,并运行Plesk来管理多个域.我尝试将权限asp.net用户添加到ImageMagick目录.PS管理员说,对于Plesk,这是我用来使用FPE在VS中访问该站点的同一帐户.

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?

谢谢

迈克

推荐答案

您需要确保为实际的应用程序池标识赋予启动该应用程序的权限.我相信plesk会在您在服务器上进行设置时为每个域创建一个特定的用户.

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.

您可以使用IIS管理器对此进行验证,以查看它所在的应用程序池和标识.

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.

这篇关于使用System.Diagnostics.Process时访问被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆