Start Process from Web Service

  • Thread starter Thread starter Dmitri Shvetsov
  • Start date Start date
D

Dmitri Shvetsov

Hi,

Can I start an external process from the Web Service?

I'm using a code, compiler keeps silence, compiles ok and starts the
project. When I trace in Debugger it doesn't start an external process.
That's strange for me. I understand that it should be a new shell, but why I
can't start it? Is it need to have a Windows application to start an
external process? I created a very long batch files and a complicated
script to work with the database using several external utilities, but I
can't call this batch files. How can I do that at all?

private int RunExecutable(string sName, string sOption){

Process process = new Process();

process.StartInfo.FileName = sName;

process.StartInfo.Arguments = sOption;

try{process.Start();}

catch{return S_Exclusion;}

process.WaitForExit();

return process.ExitCode;

}//

Regards,
Dmitri
 
Catch the exception, man! Probably the process that runs under ASPNET user
don't have rights on the path where your executable file is or some of the
inner tasks performed by the process requires more credentials.
 
Hi,

Easier. I'm going step-by-step in debugger and it ignores this call, it
steps on and then goes ahead. There is no exception. Usually catch{} shows
the exception, but in this case - nothing. To be sure - the first that I've
done - I excluded the part of code about exception at all. if it was it
would be generated and catch by IDE. Nothing at all.

Probably you're right, we should open these folders for execution, they're
blocked by the system. Maybe it's easier to create a separate process and
catch required parameters from the database and leave the WebService alone.

Thanks.

Dmitri
 
What kind of process are you trying to start? Are you sure it doesn't need an interactive console? Did you run taskman to check the
process is not running?

Willy.
 
Hi,

It's just a batch file, I know how it usually runs, it eats a lot of
resources and runs about 15 seconds. So it's easy to understand if it runs
or not. It doesn't. It doesn't require any interface etc. Just a shell to
execute. I start several EXEs from this batch file to create a database, to
run scripts, etc. I decided to create an external application to do all
stuff, but it's interesting to know is it possible at all to start an
external application using Process class?

Dmitri

Willy Denoyette said:
What kind of process are you trying to start? Are you sure it doesn't need
an interactive console? Did you run taskman to check the
 
You can easily check if the process does not execute due to a lack of
credentials by putting the ASPNET user in Administrators group. Check this
out and if everything works that this is the issue arount this behaviour.
 
Hi,

It could be a security hole. I have already created a separate process that
is running in a background and checks from time to time a database table. It
does all job if it need to be done, then waits for another query. It's safer
anyway, than to run a separate process from a web service.

Regards,

Dmitri
 
Back
Top