Last post Jun 29, 2012 02:07 PM by bbcompent1
Jun 27, 2012 10:49 AM|anshuljindal|LINK
This is my code to call a .exe file in C# Web page.
System.Diagnostics.Process process1 = new System.Diagnostics.Process();
process1.StartInfo.WorkingDirectory = "W:\\inetpub\\wwwroot\\abc\\Xyx\\";
process1.StartInfo.FileName = "FileName.exe";
Whenever i call this code it gives me following error
Message: Access is denied
StackTrace: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
Please help me to get out from this. My need here is simple i want to call a .exe file through web page.
Thanks in advance
Jun 27, 2012 10:58 AM|bbcompent1|LINK
You have to be using an account that has admin privileges in the app pool identity.
Jun 27, 2012 11:20 AM|anshuljindal|LINK
Any related expamle for this
Jun 27, 2012 11:21 AM|bbcompent1|LINK
See this MS link:
Specify an Identity for an Application Pool (IIS 7)
Jun 27, 2012 02:28 PM|Ruchira|LINK
When do you get that error? After hosting in IIS or when debuggin with Visual Studio. If it occurs after hosting in IIS, try by giving the execute permission to
ISUR for that particular program. If it occurs while debugging with VS, try by giving execute permission to ASPNET for that particular program. Following link will help you with that. See the animation.
Following link will help you too
My Tech blog | My YouTube Channel
Jun 28, 2012 05:24 AM|anshuljindal|LINK
I have given the permission to iUSR but still it is showing access is denied :(
Jun 28, 2012 07:08 AM|niceastham|LINK
Just out of curiosity, you do realise that you cannot display this .exe or process to the user in asp.net dont you?
If this code successfully executed, all that would happen is that the process or executable would run or open on the iis server and would
not be displayed to the user.
Jun 28, 2012 12:50 PM|anshuljindal|LINK
I don't want to display anything to user. i just to execute one process that is in .exe after some operation.
Jun 28, 2012 01:39 PM|bbcompent1|LINK
Does this .exe live inside your web site?
Jun 28, 2012 01:40 PM|bbcompent1|LINK
You said you gave permission to IUSR, that won't work. The account that is running the process has to be some other account. IUSR is set that way for security reasons. Have you tried setting the app pool identity to some local process account?
Jun 29, 2012 08:49 AM|anshuljindal|LINK
Yes this is live inside my website.
Jun 29, 2012 08:57 AM|anshuljindal|LINK
its little bit confusing for me to set all these
Jun 29, 2012 02:07 PM|bbcompent1|LINK
The original post I sent you shows how to set the App Pool Identity to a domain user/password. Use a real domain username and password for the app pool identity.