Hello dear readers,

Recently one of my colleagues asked me the following question:

When the following line is executed from a Web Application in Visual Studio works alright:


However, when it is invoked in the production server it fails with the following message:

[Win32Exception (0x80004005): The system cannot find the file specified]
   System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo) +614
   System.Diagnostics.Process.Start() +56
   System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +49
   System.Diagnostics.Process.Start(String fileName) +31
   Recomat.Tablero.Button1_Click(Object sender, EventArgs e) +10
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

After looking at the code I made my mind and concluded that web applications should not invoke any kind of executable (including: .exe, .bat, ) in that manner. Having that said and IF this application is a simple Proof Of Concept or a throw away work at college then the possible reasons of failure are described below:

(1) The full path is not specified: in this case the problem will be solved by simply adding the file extension (as it occurred to someone else here).

(2) The user account IUSR can’t access the file: in this case simply add read permission to this user account.

Thanks again.

Javier Andrés Cáceres Alvis

Microsoft Most Valuable Professional – MVP

Intel Black Belt Software Developer