A Repasky

A Repasky

  • NA
  • 231
  • 179.7k

Process error

Jan 8 2013 11:28 AM
This program executes many programs that runs weekly and monthly.  In a loop it reads a XML file to get the programs to run.  The weekly runs fine, but the monthly gets this error.  The production server this runs on is windows server 2003 r2.  I compiled programs using VS2008 C# on my 64-bit windows 7.  It seems that everythings runs, but I still get this error.  I do not know what to do.  Thanks for any help.
arep 

I create this message in program:

Failure in AutoExtract for switch set to Monthly 

Then program returns this error:

System.ComponentModel.Win32Exception (0x80004005): The specified executable is not a valid application for this OS platform.

   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)

   at System.Diagnostics.Process.Start()

   at AutoExtract.AutoExtract.ProcessExtract(String msg)

   at AutoExtract.AutoExtract.MonthlyExtract(String path)

   at AutoExtract.AutoExtract.Main(String[] args)


Here is code for that method.

      public static void ProcessExtract(string msg)       
      {
         int retCode = 0;

         //Run program
         Process extProcess = new Process();
         extProcess.StartInfo.FileName = executable;
         Output_Files.PrintLog(extProcess.StartInfo.FileName);
         extProcess.StartInfo.Arguments = runDate;
         extProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
         extProcess.StartInfo.CreateNoWindow = true;
         extProcess.StartInfo.WorkingDirectory = path + "";
         extProcess.Start();
         extProcess.WaitForExit();
         retCode = extProcess.ExitCode;
         extProcess.Close();
         extProcess.Dispose();

         if (retCode != 0)
         {
            string message = "The " + name + " " + msg + " Extract Failed with a return code: " + retCode.ToString();
            Exception ex = new Exception(message);
            throw ex;
         }
      }


Answers (3)