Where is the main in Windows service?

  • Thread starter Thread starter R A
  • Start date Start date
R

R A

Hi

In Windows Service application where is the main function? I see that in my
code I have
static void Main()



but when I put a break point it never gets there.





Thanks,

Ronen
 
Wouldnt this be OnStart method?



In your service class, you override base class functions that determine what
happens when the state of your service is changed in the Services Control
Manager. The ServiceBase class exposes the following methods, which you can
override to add custom behavior.

Method Override to
OnStart Indicate what actions should be taken when your service starts
running. You must write code in this procedure for your service to perform
useful work.
OnPause Indicate what should happen when your service is paused.
OnStop Indicate what should happen when your service stops running.
OnContinue Indicate what should happen when your service resumes
normal functioning after being paused.
OnShutDown Indicate what should happen just prior to your system
shutting down, if your service is running at that time.
OnCustomCommand Indicate what should happen when your service receives
a custom command. For more information on custom commands, see MSDN online.
OnPowerEvent Indicate how the service should respond when a power
management event is received, such as a low battery or suspended operation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top