How do I write a C# program that the Windows Service Control Manager (SCM) can run?
You need to create a class that inherits from `ServiceBase` and override the `OnStart` method (e.g., to launch `calc.exe`). Then use `ServiceBase.Run()` in Main to register it with SCM. Compile the `.cs` file with `csc.exe` (C# compiler) to produce an executable. A template from Didier Stevens is included in the article.
C# service programServiceBaseSCMcsc.exeWindows service development