0

I migrated the ASP C# based website from old server to new server, all the features of website works fine on new server, but this one feature

System.Diagnostics.Process proc = System.Diagnostics.Process.Start(@BatchFile)

does not the kick start the batch file.

I made: IIS admin account as Local account and Interacts with desktop. ASP net account - I assigned local administrator account IUSER account - made it as local administrator

Can some one please suggest what else I am missing.

  • 2
    Are there any errors that are returned or logged? Does the batch file use an executable that might not be installed on the new server? – Yaakov Ellis Aug 25 '13 at 11:48
  • Have a llok [here](http://stackoverflow.com/questions/1390559/how-to-get-the-output-of-a-system-diagnostics-process) to log the outcome of your call – rene Aug 25 '13 at 11:50
  • Are there any differences in the `PATH` environment variable between the two servers? – Seph Aug 25 '13 at 11:50

1 Answers1

0

You say there was a migration to a new server. Probably you have invalid paths, bad permissions, the wrong identity or all of the above.

  1. Determine and validate the paths to everything the batch needs including the batch file itself.
  2. Set up any network paths you need and make certain that the identity used by the app pool (or the one you supply when launching the process, if you're doing that) has the permissions to launch the batch and touch all the resource dependencies.
  3. Validate that the batch works and positively determine the required working directory.
  4. Find out what the C# code regards as the CurrentDirectory. You may need to write it to the event log, or maybe you can surface this information in the HTTP response. While you're at it, also surface the identity that's actually in use.
  5. Control your process environment. Use ProcessStartInfo.WorkingDirectory property to control the working directory. When the UseShellExecute property is false, gets or sets the working directory for the process to be started. When UseShellExecute is true, gets or sets the directory that contains the process to be started.
Peter Wone
  • 17,965
  • 12
  • 82
  • 134