Access denied when executing Process.Start() on my Server 2003

C

Cédric Rossé

Hello,

I'm currently developping a web application and I'm trying to execute a
batch file (.cmd) on the server side when the client presses a button on a
web page.
When I do this on my local machine (where I'm developping my application),
no problem occurs. But when I put the web application on my Windows server
2003 server, I always get the following error message. Can someone help me ?

Here is the config of my webconfig file :
<authentication mode="Windows" />

<identity impersonate="true"/>

And Here is the section process model of my machine.config file:

<processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000"
restartQueueLimit="10" memoryLimit="60" webGarden="false"
cpuMask="0xffffffff" userName="SYSTEM" password="AutoGenerate"
logLevel="Errors" clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00" maxWorkerThreads="20"
maxIoThreads="20"/>


Server Error in '/NetGuard' Application.
--------------------------------------------------------------------------------

Access is denied
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: Access is denied

Source Error:


Line 63: myProcess.StartInfo.FileName =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD\\NetSH.cmd";
Line 64: myProcess.StartInfo.WorkingDirectory =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD";
Line 65: myProcess.Start();
Line 66:
Line 67: /*StreamReader sOut = myProcess.StandardOutput;


Source File: c:\inetpub\wwwroot\netguard\netguard_agent.cs Line: 65

Stack Trace:


[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo) +1106
System.Diagnostics.Process.Start() +85
NetGuard.Sys.NetGuard_Agent.ProcessCommand(NetGuard_Data _NetGuard_Data,
String _RoomName, String _RuleName) in
c:\inetpub\wwwroot\netguard\netguard_agent.cs:65
NetGuard.Generation.ScriptButton_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\NetGuard\Generation.aspx.cs:62
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277




Thanks in advance for all responses !

Cédric
 
P

Paul Glavich [MVP - ASP.NET]

Try going into the .Net framework configuration permission set to "Full
Access" on the Runtime Security Policy --> Machine --> Code Groups -->
All_Code --> Internet Zone. By default, the "security" permission set that
is applied to the internet zone does not allow calls to unmanaged code.

You can acess this by going to Administrative tools and .Net framework
configuration V1.1

Also ensure that the impersonated user or group has access to the respective
files and directories.

--
- Paul Glavich
Microsoft MVP - ASP.NET


Cédric Rossé said:
Hello,

I'm currently developping a web application and I'm trying to execute a
batch file (.cmd) on the server side when the client presses a button on a
web page.
When I do this on my local machine (where I'm developping my application),
no problem occurs. But when I put the web application on my Windows server
2003 server, I always get the following error message. Can someone help me ?

Here is the config of my webconfig file :
<authentication mode="Windows" />

<identity impersonate="true"/>

And Here is the section process model of my machine.config file:

<processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000"
restartQueueLimit="10" memoryLimit="60" webGarden="false"
cpuMask="0xffffffff" userName="SYSTEM" password="AutoGenerate"
logLevel="Errors" clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00" maxWorkerThreads="20"
maxIoThreads="20"/>


Server Error in '/NetGuard' Application.
-------------------------------------------------------------------------- ------

Access is denied
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: Access is denied

Source Error:


Line 63: myProcess.StartInfo.FileName =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD\\NetSH.cmd";
Line 64: myProcess.StartInfo.WorkingDirectory =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD";
Line 65: myProcess.Start();
Line 66:
Line 67: /*StreamReader sOut = myProcess.StandardOutput;


Source File: c:\inetpub\wwwroot\netguard\netguard_agent.cs Line: 65

Stack Trace:


[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo) +1106
System.Diagnostics.Process.Start() +85
NetGuard.Sys.NetGuard_Agent.ProcessCommand(NetGuard_Data _NetGuard_Data,
String _RoomName, String _RuleName) in
c:\inetpub\wwwroot\netguard\netguard_agent.cs:65
NetGuard.Generation.ScriptButton_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\NetGuard\Generation.aspx.cs:62
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277




Thanks in advance for all responses !

Cédric
 
G

Guest

Humm...

Just try going through the following link i am sure your problem will get
resolved after this:
"http://support.microsoft.com/default.aspx?scid=kb;en-us;842789"

Best of luck!
-Hitesh Jain

Cédric Rossé said:
Hello,

I'm currently developping a web application and I'm trying to execute a
batch file (.cmd) on the server side when the client presses a button on a
web page.
When I do this on my local machine (where I'm developping my application),
no problem occurs. But when I put the web application on my Windows server
2003 server, I always get the following error message. Can someone help me ?

Here is the config of my webconfig file :
<authentication mode="Windows" />

<identity impersonate="true"/>

And Here is the section process model of my machine.config file:

<processModel enable="true" timeout="Infinite" idleTimeout="Infinite"
shutdownTimeout="0:00:05" requestLimit="Infinite" requestQueueLimit="5000"
restartQueueLimit="10" memoryLimit="60" webGarden="false"
cpuMask="0xffffffff" userName="SYSTEM" password="AutoGenerate"
logLevel="Errors" clientConnectedCheck="0:00:05"
comAuthenticationLevel="Connect" comImpersonationLevel="Impersonate"
responseDeadlockInterval="00:03:00" maxWorkerThreads="20"
maxIoThreads="20"/>


Server Error in '/NetGuard' Application.
--------------------------------------------------------------------------------

Access is denied
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: Access is denied

Source Error:


Line 63: myProcess.StartInfo.FileName =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD\\NetSH.cmd";
Line 64: myProcess.StartInfo.WorkingDirectory =
"C:\\Inetpub\\wwwroot\\NetGuard\\CMD";
Line 65: myProcess.Start();
Line 66:
Line 67: /*StreamReader sOut = myProcess.StandardOutput;


Source File: c:\inetpub\wwwroot\netguard\netguard_agent.cs Line: 65

Stack Trace:


[Win32Exception (0x80004005): Access is denied]
System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo
startInfo) +1106
System.Diagnostics.Process.Start() +85
NetGuard.Sys.NetGuard_Agent.ProcessCommand(NetGuard_Data _NetGuard_Data,
String _RoomName, String _RuleName) in
c:\inetpub\wwwroot\netguard\netguard_agent.cs:65
NetGuard.Generation.ScriptButton_Click(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\NetGuard\Generation.aspx.cs:62
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277




Thanks in advance for all responses !

Cédric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top