« Previous Next »

Thread: "Faulting Application" error when executing EXE

Last post 07-15-2009 6:51 PM by anilr. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 02-11-2009, 11:36 AM

    "Faulting Application" error when executing EXE

    I am trying to execute an EXE (cmd.exe to be exact) on the web server using an asp.net web page. When I execute the EXE on a server 2003 box with IIS 6.0 it works fine. When I try to execute it on a server 2008 box with IIS 7.0, I receive this error in the Application Event Log (no error is caught by my program):
    "Faulting application cmd.exe, version 6.0.6001.18000, time stamp 0x47919317, faulting module kernel32.dll, version 6.0.6001.18000, time stamp 0x4791adec, exception code 0xc0000142, fault offset 0x00000000000b1188, process id 0x10ec, application start time 0x01c98c5d97fde641."

    Because it works on the IIS 6.0 box, I immediately think that I may have to configure something in IIS 7.0's configuration to allow the running of an EXE from an ASP.net page. Any ideas?

    Just in case, here is the code:
    StreamReader sr = null;
    ProcessStartInfo psi = null;

    try {
    psi = new ProcessStartInfo("cmd.exe", "ping 10.147.0.132");
    psi.RedirectStandardOutput = true;
    psi.RedirectStandardInput = true;
    psi.RedirectStandardError = true;
    psi.Domain = "domain";
    psi.UserName = "username";
    psi.Password = password;
    psi.UseShellExecute = false;

    //start the process
    Process p = Process.Start(psi);
    p.WaitForExit();
    sr = p.StandardOutput;

    //put output to message
    lblMessage.Text = "Result: " + sr.ReadToEnd();
    } catch (Exception ex) {
    lblMessage.Text = ex.Message;
    }

    Is there a better forum for my question?

    Thanks.
    Zach
  • 07-14-2009, 8:21 AM In reply to

    • Solarez
    • Top 500 Contributor
    • Joined on 01-18-2007, 2:33 PM
    • Posts 15

    Re: "Faulting Application" error when executing EXE

    what is the result of running IIS 7 in IIS 6 compatibility mode or using the classic pipeline instead of the integrated pipeline?

  • 07-15-2009, 6:48 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: "Faulting Application" error when executing EXE

    This is probably happening because the windows-station/desktop that the IIS worker process is running under does not allow permission to the username you are trying to launch the command as.  You must have configured IIS6 to interact with desktop which is no longer possible to do on vista and later windows operating system.  You can either try launching the process as the worker process identity or you will have to manually specify the desktop to CreateProcessWithLogon call (and use PInvoke rather than use the ProcessStartInfo/Process classes).

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 07-15-2009, 6:51 PM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 6:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: "Faulting Application" error when executing EXE

    Also see this thread for the solution using PInvoke.

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
Page 1 of 1 (4 items)
Microsoft Communities