Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows Services

Status
Not open for further replies.

Alcar

Programmer
Sep 10, 2001
595
US
has anyone of you worked with Windows Services so far?

I'm thinking about creating one to work sidebytside with an ASP.NET application I have.
It would work like a SQL Server Trigger. It will run some stored procedures on the DB every given time or every certain action of the user on the Web Application.

I am trying to read through the walkthroughs but I'm getting slightly lost...
Daren J. Lahey
Just another computer guy...
 
I have a little Daren I made one that did some database calls and emailed out letters every day at midnite.

What were you haveing troubles with. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
one step at a time:

- What is the life cycle of a service?

OnStart is fired when the Service is Loaded the first time or called every given time?
Should I create a loop statement that recalls my classes every given time or is this already managed by the System.ServiceProcess.ServiceBase Class?


Daren J. Lahey
Just another computer guy...
If you are unsure of forum etiquette check here FAQ796-2540
 
I guess it depends on what your service does.

Many services start on computer start or on an application start. They will then run either untill they are explicitly ended from and application, user "intermucking" (brand new word) or the computer shuts down.

I believe that the onStart is fired whenever the service is started... Not sure of your question here anymore so I am going to stop rambling.

A service isn't really called is it? It just does stuff.

Hmm. still rambling.. Anyway I am a little uncertain as I haven't had the chance to test mine yet. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
well as I see it services should:

- start and hang (started)
- on given time, execute code (called)
- repeat above until service is stopped. (stopped)

right?
Daren J. Lahey
Just another computer guy...
If you are unsure of forum etiquette check here FAQ796-2540
 
Heh Heh we are arguing the same point.
Thats exactly how I see them.

What did you mean by recalls your classes? That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Well I suppose I am not going to write a loop that hangs my program for X time and then moves to a procedure. I more believe in a Service Controle Manager that, once it has a service started with a given time property, it will (re)call such service(exe) at due time.

Or should I really start thinking of something like:

do until time = true
sleep(1000)
loop
[...] rest of the code

?? Daren J. Lahey
Just another computer guy...
If you are unsure of forum etiquette check here FAQ796-2540
 
Well what I did was on start I setup and started a timer.

Then in the Timer.Elapsed event I call a function.

Within that function is all my code.

The service waits the set time on the timer then does it's thing and waits until the timer goes off again.

Its not quite your do until, but anything that needs to do something at a certain time has a loop of some sort waiting until a condition is met. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top