tags:

views:

58

answers:

1

Hi,

  1. I need to start an executable from a WCF service which should run under the same service account that the WCF service uses. The WCF service is hosted in IIS and configured to run under a specific service account.
  2. I also need to get a handle to that process and save it somewhere (in database for example) so that I can kill later if it runs for a long time unexpectedly.
  3. I should be able to start multiple instances of that process in parallel with different arguments.

Is this possible OR do I need to create a windows service (assuming it does the same thing what executable does) and configure it with an account and start it from WCF service? Please let me know what is the right solution for this. thanks.

+1  A: 

You should just be able to kick off a new process using System.Diagnostics.Process and use the Start method. It will run under the context it was started under.

Josh
I thought that isn't the case and this article says it runs under restricted permissions http://msdn.microsoft.com/en-us/library/e8zac0ca(VS.90).aspx. It says "ASP.NET Web page and server control code executes in the context of the ASP.NET worker process on the Web server. If you use the Start method in an ASP.NET Web page or server control, the new process executes on the Web server with restricted permissions. The process does not start in the same context as the client browser, and does not have access to the user desktop." does it not apply to WCF services?
RKP
also any comments on my second question?
RKP