简体   繁体   English

System.Diagnostics.Process.Start访问被拒绝

[英]System.Diagnostics.Process.Start Access Denied

I have a Web Application running under IIS on a Azure VM. 我有一个在Azure VM上的IIS下运行的Web应用程序。 It is attempting to execute a Windows32 application. 它正在尝试执行Windows32应用程序。 When I run the application, I always get this exception -> system.diagnostics.process.start access denied. 当我运行应用程序时,总是会遇到此异常-> system.diagnostics.process.start访问被拒绝。 I have tried to execute the program in a command prompt shell and it works without having to be run under administration. 我试图在命令提示符外壳中执行该程序,并且无需在管理下运行即可正常运行。

The code - 编码 -

string fileIn = us_post_directory + loan.loan_file;
string fileOut = us_ocr_directory + loan.loan_file;
string password = loan.password;

var p = new System.Diagnostics.Process
{
    StartInfo =
    {
        UseShellExecute = false,
        FileName = "C:\\Program Files <x86>\\PlotSoft\\PDFill\\PDFill.exe",
        //FileName = "E:\\PlotSoft\\PDFill\\PDFill.exe",
        Arguments =
            String.Format(" DECRYPT \"{0}\" \"{1}\" -password \"{2}\"", fileIn, fileOut,
                password)
    }
};
p.Start();

Web Applications run under the context of IIS, which does not have access to many of Windows sub-systems. Web应用程序在IIS的上下文中运行,而IIS不能访问许多Windows子系统。 You will need to configure IIS, specifically the AppDomain for the site, to run as a service account that you create and give permissions to. 您将需要配置IIS,尤其是网站的AppDomain,以作为您创建并为其授予权限的服务帐户运行。 Depending on the application, the service account will probably need a user profile and permission to access too. 根据应用程序的不同,服务帐户可能还需要用户配置文件和访问权限。 Some of these steps require using gpedit to configure your local machine policy or domain policy. 其中某些步骤需要使用gpedit来配置本地计算机策略或域策略。

The exact steps and permissions needed will depend on the application you are trying to run and what it expects to have access to. 所需的确切步骤和权限将取决于您尝试运行的应用程序以及期望访问的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM