1

I want to execute .exe file from the web application i use the following code

protected void btnImport_Click(object sender, EventArgs e)
    {
        Process p = new Process();
        p.StartInfo.FileName = "c:\\backup_restore.exe";
        p.Start();
    }

but i get %1 is not a valid Win32 application error what could be solution for this

I have also make Enable 32-bit Application TRUE in DefaultAppPool

  • Have you made sure the file name c:\\backup_restore.exe exists and that you can run it on that server simply by clicking on it? That error seems to indicate the exe is not valid, either corrupted or not an executable in the first place. – park896 Jun 10 '17 at 14:11
  • yes i have file name backup_restore.exe in c drive and it runs when i double click it – Anil Bir Singh Tuladhar Jun 10 '17 at 14:13
  • Can you show us the exact error message? Is it YOSD since you are calling it from a Web form? – IrishChieftain Jun 10 '17 at 14:38
  • %1 is not a valid Win32 application Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ComponentModel.Win32Exception: %1 is not a valid Win32 application Source Error: Line 32: Process p = new Process(); Line 33: p.StartInfo.FileName = "C:\\backup_restore.exe"; Line 34: p.Start(); Line 35: Line 36: } – Anil Bir Singh Tuladhar Jun 10 '17 at 14:43
  • https://stackoverflow.com/questions/4610091/not-a-valid-win32-application – IrishChieftain Jun 10 '17 at 14:46
  • Also take a look at this: https://support.microsoft.com/en-us/help/812486/event-id-7000-and-1-is-not-a-valid-win32-application-error-message-when-you-start-a-service – IrishChieftain Jun 10 '17 at 14:48
  • I have viewed this as well but no result – Anil Bir Singh Tuladhar Jun 10 '17 at 14:49

0 Answers0