Batch file is not running on IIS?

AnkiIt_wizard5 66 Reputation points
2021-03-01T05:04:48.873+00:00

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.

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,281 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,358 questions
Windows Server
Windows Server
A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.
12,398 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce Zhang-MSFT 3,736 Reputation points
    2021-03-02T03:25:52.957+00:00

    Hi @AnkiIt_wizard5 ,

    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

    0 comments No comments

  2. Alvaro Ignacio Arancibia Prado 1 Reputation point
    2021-05-11T19:13:12.317+00:00

    Hi,
    I am working with IIS 10 and I cannot add the user because the default application pool and other application pools cannot be found.
    95712-2021-05-11-15-11-36.png