0

Envrionment: .Net 2.0, Windows 2003, 64bit

I am trying to move the website from old server to new server, and below code is not working anymore after moving the codes:

    System.Diagnostics.ProcessStartInfo psi = new
    System.Diagnostics.ProcessStartInfo("cmd.exe");
    psi.UseShellExecute = false;
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardInput = true;
    psi.RedirectStandardError = true;
    // Start the process
    System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
    System.IO.StreamReader strm = proc.StandardError;
    System.IO.StreamReader sOut = proc.StandardOutput;

    // Attach the in for writing
    System.IO.StreamWriter sIn = proc.StandardInput;

    sIn.WriteLine(exec);

    strm.Close();
    sIn.WriteLine("EXIT");

    proc.Close();

    // Read the sOut to a string.
    string results = sOut.ReadToEnd().Trim();

    // Close the io Streams;
    sIn.Close();
    sOut.Close();

It seems as the system does not allow to run none of .exe. The code was working properly on previous server, so I am guessing it is some types of system config issue. I found similar issue on here: Foo.cmd won't output lines in process (on website)

but I did not understand the part "create a new user with privileges to execute batch scripts and select that user as the AppPool user in IIS".I know how to create a new user, but was not able to figure out the way giving a permission to the user to execute .exe or batch files.

Any advice would be helpful.

Thank you,

Community
  • 1
  • 1

1 Answers1

0

It could be a .NET Trust level on the new server. Try setting the Trust level in IIS manager to "Full" for that application.

  • Just setup a user account then. For example, on my Dev machine I have a local user named websvr that has full nuts permissions to my websites folder. I then set my app pool to use the websvr account instead of the default user that ms sets up with iis. – Jeremy Rammalaere Jan 31 '15 at 00:11
  • For testing purpose, I used administrator user account for app pool. Since administrator account has all permissions, I thought it should be working but no success. Any other ideas that I might be missing? Here is more information of the app pool setting: Process Model Identity= administrator, version= 2.0, Managed Pipeline Mode = Classic – BJ Kang Jan 31 '15 at 00:20
  • Have you checked the Windows Application Event Log for errors? – Jeremy Rammalaere Feb 02 '15 at 19:51