Note that there are some explanatory texts on larger screens.

plurals
  1. PORunning bat file on IIS server
    primarykey
    data
    text
    <p>I'm trying to run a .bat file on a windows server 2008 R2 64bit with iis version 6.1 SP1. On my local machine everything goes well but on server nothing happens, except for a process that gets created (cms.exe *32).</p> <p>From my search the main problem is permissions. I read in several places that iis for default blocks access to batch files for security reasons. I do understand the problem but in my case there would be no security issue so i would like to still run my file.</p> <hr> <p>The solutions i found passed by implementing impersonation which means:</p> <p>1- change web.config -> identity impersonate="true"</p> <p>2- change iis site authentication -> ASP.NET Impersonation Enabled</p> <p>3- give permissions to the file and folders</p> <p>4- even tried a different version of step 1 -> identity impersonate="true" userName=<strong><em>*</em>**<em></strong> password=<strong></em>**<em>*</em>*</strong></p> <hr> <p>Give permissions to the IIS User:</p> <p>1- set allow service to interact with desktop on the IIS Admin Service</p> <hr> <p>To call the batch i use the following code in c#:</p> <pre><code>private void startPervasive(string npu) { try { ProcessStartInfo startInfo = new ProcessStartInfo(ConfigurationManager.AppSettings.Get("PervasivePath")); //startInfo.UseShellExecute = true; //startInfo.WorkingDirectory = ConfigurationManager.AppSettings.Get("PervasiveWorkingPath"); //startInfo.WindowStyle = ProcessWindowStyle.Normal; //startInfo.RedirectStandardInput = true; //startInfo.RedirectStandardError = true; //startInfo.RedirectStandardOutput = true; ////startInfo.FileName = ConfigurationManager.AppSettings.Get("PervasivePath"); startInfo.Arguments = npu; Process myProcess = Process.Start(startInfo); //StreamReader sr = File.OpenText(ConfigurationManager.AppSettings.Get("PervasivePath")); //StreamWriter sw = myProcess.StandardInput; //while (sr.Peek() != -1) //{ // string readed = sr.ReadLine(); // readed = readed.Replace("%1", npu); // sw.WriteLine(readed + Environment.NewLine); //} ////myProcess.WaitForExit(); //myProcess.Close(); } catch (Exception ex) { throw ex; } </code></pre> <p>It should also be of note that i tried to execute other files including .exe files but with no results.</p> <p>Would appreciate any advice, help and or corrections to the steps described.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload