question

AnkiItwizard5-8193 avatar image
0 Votes"
AnkiItwizard5-8193 asked ·

Batch file is not running on IIS?

Batch file is not ruuning on IIS
i m using window server r2 2012
I give full control accessibility but i don't what actually happens?
help me.

code:

             string command = "c://PExecute.bat";
             ProcessStartInfo procStartInfo = new ProcessStartInfo("cmd", "/q /c " + command);
               
             procStartInfo.UseShellExecute = false;
             procStartInfo.CreateNoWindow = true;

             Process proc = new Process();
             proc.StartInfo = procStartInfo;
             proc.StartInfo.CreateNoWindow = true;
             proc.Start();

Thanks in advance.

windows-server-iis-generalwindows-server-essentialsdotnet-aspnet-mvc
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

BruceZhang-MSFT avatar image
0 Votes"
BruceZhang-MSFT answered ·

Hi @AnkiItwizard5-8193 ,

To execute batch files through IIS, you need to grant sufficient permissions to the application pool.

If you use anonymous authentication on IIS, please edit it and check Application pool identity.
73213-2021-03-02-111600.jpg

Then assign FullControl security permissions for the IIS AppPool\ApplicationPool. Because application pool is the user of current process. Process uses the identity of application to run batch file.

Find the directory where the batch file is located and go to the directory properties. In security tab, add the application pool, assign the FullControl permission.
73188-2021-03-02-112217.jpg
73254-2021-03-02-112303.jpg




If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our  documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Best regards,
Bruce Zhang






·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.