How to make windows service application so it can run as a standalone program as well?
问题 I'll start with an example: Apache web server (under Windows) has a nice feature: it can be both run as a standalone application (with current users privileges), and that it can be installed and run as a windows service directly (as local system account), using same executable. In order for application to be run as a standalone app, all it needs to do is along the lines of having static public Main() in some public class. In order for application to be installable and runnable as service, it