I\'m curious how exactly the Main()
method works in a windows service as it relates to the Service Control Manager. When is it executed? How does it hook into t
When you use the Control Panel applet to tell the service to start the SCM launches the process; this causes the code inside of Main() to run. The ServiceBase.Run() line in the Main() method hooks the associated services into the SCM who then calls the OnStart() method for each of the services specified in the ServiceBase.Run() method call.