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

本文关键字:拒绝 访问 Start Diagnostics Process System | 更新日期: 2023-09-27 18:29:14

我有一个Web应用程序在Azure VM上的IIS下运行。它正在尝试执行Windows32应用程序。当我运行应用程序时,我总是得到这个异常->system.diagnostics.process.start访问被拒绝。我曾尝试在命令提示符shell中执行该程序,它无需在管理下运行即可运行。

代码-

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

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

Web应用程序在IIS的上下文下运行,IIS无法访问许多Windows子系统。您需要配置IIS,特别是网站的AppDomain,以作为您创建并授予权限的服务帐户运行。根据应用程序的不同,服务帐户可能还需要用户配置文件和访问权限。其中一些步骤需要使用gpedit来配置本地计算机策略或域策略。

所需的确切步骤和权限将取决于您试图运行的应用程序以及它希望访问的内容。