473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

base.OnStart() in Service Application

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
Nov 16 '05 #1
1 5486
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" <an*******@discussions.microsoft.com> wrote in message
news:43**********************************@microsof t.com...
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

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Nishen | last post by:
Hi, I want my service to sit in an endless loop and run a stored procedure every say, 1 hour. protected override void OnStart(string args) { while(1=1) { open connection
3
by: Dave Wright | last post by:
Hi, I am implementing a service that connects to an SMS Controller. We are implementing this using an assembly in the OnStart() method of a Windows service. This is working fine, however I...
6
by: Next | last post by:
Hello, In my OnStart event I have several checks to make sure values in the config file are correct. If any of the values are incorrect I don't want the service to start. Is there a "cancel...
3
by: Mike Frank | last post by:
What is the correct way to abort a service start in the OnStart method if things were detected which will not let the service run properly? I could simply throw an exception and the serice will...
2
by: SQLScott | last post by:
In the OnStart sub of my service (as the service is starting up) I check for certain things. If one of a few things don't jive, I want to "cancel" the starting of the service. How do I...
2
by: Michael Groeger | last post by:
Hi ng, I have written a service with .NET FW 1.0. The service runs as expected on all machines but one (Windows 2000 Server, SP4). The OnStart method of the service is left so that the mmc...
1
by: SharpCoderMP | last post by:
hi, as in subject - how can i do that? when my service starts up it performs some tests within OnStart method. i would like it to refuse to start if some of these tests fail. there is simply no...
1
by: =?Utf-8?B?V2lsZCBXaWxkIE1pa2U=?= | last post by:
I have a windows service implementation that creates an HttpListener in OnStart to help capture port conflict issues while starting vs. when the service is already started. On Windows 2003 servers...
0
by: ERobishaw | last post by:
I have a windows service that initializes (i.e., the Service:ServieBase class gets constructed), but the OnStart() method never fires. I can attach a debugger to it, and it's just sitting on:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.