base.OnStart() in Service Application

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I've created a Windows service application and I would like to know if I should be calling base.OnStart(args) and base.OnStop inside my overridden OnStart and OnStop methods? If yes, I have a little bit of code in my OnStart method so should I call it at the beginning of my method or at the end? Also, if yes, should I call base.OnStop() as the first or last line in my OnStop method?

Thanks,
Mike
 
The OnXXX methods of the ServiceBase class are there to be overridden by
subclasses for callbacks. They are basically just stub methods that do
nothing, so you don't need to call them at all.

Mike001 said:
Hi,

I've created a Windows service application and I would like to know if I
should be calling base.OnStart(args) and base.OnStop inside my overridden
OnStart and OnStop methods? If yes, I have a little bit of code in my
OnStart method so should I call it at the beginning of my method or at the
end? Also, if yes, should I call base.OnStop() as the first or last line in
my OnStop method?
 

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

Back
Top