We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Error when executing exe from ASP.NET page on Server 2008 IIS 7 server

Medium Priority
Last Modified: 2012-08-13
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?

Is there a better forum for my question?

StreamReader sr = null;
ProcessStartInfo psi = null; 
try {
psi = new ProcessStartInfo("cmd.exe", "ping");
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);
sr = p.StandardOutput; 
//put output to message
lblMessage.Text = "Result: " + sr.ReadToEnd();
} catch (Exception ex) {
lblMessage.Text = ex.Message;

Open in new window

Watch Question

You are attempting to run "cmd.exe" on the Windows 2008 Server, which may be locked-down.  You need to grant access to the IIS account that is executing your web application to run the "cmd.exe" shell.

This article explains what you need to do:



In the code you will see that I am assigning a domain, username, and password to the ProcessStartInfo object. That user does have rights to access anything on the server. If I run it without passing the username and password, I do receive an error that the user does not have the rights to access the file, When I do pass the username and password I don't receive the "no accees" error, I receive the "Faulting Application" error above.
Ted BouskillSenior Software Developer
Top Expert 2009

It's funny.  Microsoft is spending money trying to make Windows and IIS more secure and then questions like this come along to make it less secure.  Sadly Microsoft gets the blame when it's servers are hacked.

Is this an intranet site?  What are you trying to achieve on the command line.  Maybe we can help you get the same result without lowering the security of your server.

From the code, he appears to be trying to perform a "ping".



I am trying to successfully execute the code above on server 2008 IIS 7.
Ted BouskillSenior Software Developer
Top Expert 2009

Are you simply trying to verify that the server at that address is running?  You can do that directly in C# code without shelling out to the command prompt.


cmd.exe is simply being used as an example of not being able to run an exe successfully. every exe i try to run results in the "Faulting Application" error.
Senior Software Developer
Top Expert 2009
Back to my original comment.  A web application has been designed to run in a sandbox and Microsoft is actually trying to prevent you from running other EXE's to protect your server.  However, if you add the EXE to the 'Web Server Extensions' and make sure any DLL's the EXE uses are trusted or in the GAC then you can execute it safely.

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.