C
C#2y ago
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!
3 Replies
Foomf
FoomfOP2y ago
mindhardt
mindhardt2y ago
OnStart seems like empty virtual method to add some actions on startup, I would assume it is called inside Run()
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server