views:

865

answers:

4

Duplicate: http://stackoverflow.com/questions/717657/is-it-possible-to-run-an-executable-from-a-web-service

Hi

I have Webservice, and I want to run exe file through this Webservice

the Webservice and the exe file are on same computer

How can I do it ?

thank's in advance

+3  A: 

Process.Start()?

Arnshea
+3  A: 

You can use the System.Diagnostics.Process object to start an external process.

EDIT:

Documentation

Example using some advanced features (input/output/error redirecting). It's in VB, but should be easy to port.

Pwninstein
+1  A: 
Process.Start("path of the program");
Thomas Levesque
A: 
Process.Start("app.exe")

OR even better, wrap it in a Windows Service, publish a schema for it and consume through async request to a bus.

Henrik
I know this, but it seems that in Webservice is not working !!!
Gold
Because you need to call: WaitForExit() on the Process instance, otherwise you don't get the result on the main thread.
Henrik