0

Using C# I would like to send CTRL+C (break) to a certain console process that I'm running from a service (background process) as it seems the only valid way of terminating it.

How can I do that?

Eran Betzalel
  • 4,105
  • 3
  • 38
  • 66

1 Answers1

0

You can add a simple WCF service to your console application which has a single method: public void Kill()

In the master service you will have a client of that service which will invoke the "Kill" method when necessary. in the implementation of that Kill() method, you can call System.Exit() or do any other shutdown actions your background process requires.

omer schleifer
  • 3,897
  • 5
  • 31
  • 42