Foomf
❔ ServiceBase question: is Main() or OnStart() my entry point?
I have a program that extends
ServiceBase
. I am given a method to override called OnStart()
. When my app is running as a windows service, is this the entry point? The tutorial I followed also has me calling ServiceBase.Run()
in my Main()
method.
The reason I'm asking is because I'm trying to decide where I should set up my logger. My app also needs to run as a console app. My Main()
method has a Environment.UserInteractive
branch. If user interactive, I run as a console app. If not user interactive, I call ServiceBase.Run()
. If this is the incorrect approach, feedback would be much appreciated!4 replies