Hi to all,
I have made a web service which creates a batch file in a folder in web server and tries to execute it (in a Windows Server 2003 web server). So far I have managed to create the batch file successfully by adjusting the permissions of the folder it is created in, for the user which is assigned to run the web application for the specific application pool. But when the web service tries to execute the newly created batch file (using the System.Diagnostics.Process class), I get this exception :
System.ComponentModel.Win32Exception: Access is denied
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at MyService.MakeBatchFileAndRun(String xmlString) in
c:\wwwroot\App_Code\TestWadjaMusicService.cs:line 46
My first question is this: Is it possible to execute a batch file through a web service? If it's not, it's not worth trying to do it.
And if it's possible (I hope so), which is the user context of the opening process? Is the ASP.NET user which runs this process or someone else?
If it indeed is the ASP.NET user, I have given him the permissions to execute scripts in the folder of the newly created batch file but still I get an exception. Anyway, any opinion would be extremely helpful. Thanks in advance.