Cannot kill process from wcf hosted as windows service

时间:2016-04-15 14:50:24

标签: vb.net wcf

I created a wcf hosted windows service that kill remote process but it does not work.

when i try the code bellow from my client form, it's working

when i try the code bellow from wcf app running without wrapped into a service, it's working too. So it seems that it's not possible to run process.start from my service

The service is installed as local system on the computer that running client, service and application to kill. Here is the code:

Process.Start("taskkill", String.Format("/S {0} /FI ""USERNAME eq {1}"" /PID {2}", hostName, user, hostProcess)).WaitForExit()

1 个答案:

答案 0 :(得分:0)

I could achieve this by changing the user that run the service in the property of the service. So i run the service as domain Administrator