Craig
Craig

Reputation: 1225

System.Diagnostics.Process.Start Access Denied

I have a Web Application running under IIS on a Azure VM. It is attempting to execute a Windows32 application. When I run the application, I always get this exception -> system.diagnostics.process.start access denied. 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();

Upvotes: 0

Views: 2428

Answers (1)

Bradley Uffner
Bradley Uffner

Reputation: 16991

Web Applications run under the context of IIS, which does not have access to many of Windows sub-systems. 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. 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.

The exact steps and permissions needed will depend on the application you are trying to run and what it expects to have access to.

Upvotes: 2

Related Questions