473,320 Members | 2,146 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,320 software developers and data experts.

Mantaining a Windows Service

Hi,
I've been trying to write a Windows Service that handles specific events.
However, when I start it, it is immediately stopped, since it is idle when
none of the events are triggered. And when it's stopped, it can't handle the
events. How can I keep it running?
Reuben.
Sep 30 '05 #1
4 1206
Put it in a loop that continually spins or that sleeps.
"Reuben" <Re****@discussions.microsoft.com> wrote in message
news:03**********************************@microsof t.com...
Hi,
I've been trying to write a Windows Service that handles specific events.
However, when I start it, it is immediately stopped, since it is idle when
none of the events are triggered. And when it's stopped, it can't handle
the
events. How can I keep it running?
Reuben.

Sep 30 '05 #2

while(true)

Reuben wrote:
Hi,
I've been trying to write a Windows Service that handles specific events.
However, when I start it, it is immediately stopped, since it is idle when
none of the events are triggered. And when it's stopped, it can't handle
the events. How can I keep it running?
Reuben.


--
The Texeme Construct, http://www.texeme.com
360, http://360.yahoo.com/manfrommars_43
Sep 30 '05 #3
When running a service a message loop is started. This means that a service
can go idle without exiting just like a normal window. If you create a
windows service from scratch from VS.net and run it, it will not exit even
though there is no work for it to do. So my guess is that there is something
wrong with your code so that your service crashes after start-up. Did you
check the event log? Putting in an infinite loop sounds like a bad idea.

Regards, Jakob.

--
http://www.dotninjas.dk
http://www.powerbytes.dk
"Reuben" wrote:
Hi,
I've been trying to write a Windows Service that handles specific events.
However, when I start it, it is immediately stopped, since it is idle when
none of the events are triggered. And when it's stopped, it can't handle the
events. How can I keep it running?
Reuben.

Sep 30 '05 #4
Jakob Christensen wrote:
When running a service a message loop is started. This means that a
service can go idle without exiting just like a normal window. If
you create a windows service from scratch from VS.net and run it, it
will not exit even though there is no work for it to do. So my guess
is that there is something wrong with your code so that your service
crashes after start-up. Did you check the event log? Putting in an
infinite loop sounds like a bad idea.


I agree. The OP does not say how clients talk to this service, is it
through some kind of IPC? If so, have you got a problem in that
listening mechanism?

Richard
--
http://www.grimes.demon.co.uk/workshops/fusionWS.htm
http://www.grimes.demon.co.uk/workshops/securityWS.htm
Oct 16 '05 #5

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

Similar topics

11
by: Michael Riggio | last post by:
Is there a way to have a windows service instantiate a class that is a web service, which will then be accessible to clients via HTTP? Thanks, -Mike
1
by: Artur Kowalski | last post by:
I have a NotifyIcon in my Windows Service project and I am trying to add a ContextMenu to this NotifyIcon or use some of the mouse events. Everything isn't working. I think so base class of the...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
1
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. I'm having trouble getting the code that I've written to work, can anyone shed some light as to where I'm...
0
by: Scott Davies | last post by:
Hi, I'm looking for some help on a small program that I'm trying to develop in VB.NET. The program I'm trying to develop needs to be able to do the following: - Select remote server -...
4
by: Reuben | last post by:
Hi, I've been trying to write a Windows Service that handles specific events. However, when I start it, it is immediately stopped, since it is idle when none of the events are triggered. And when...
2
by: deko | last post by:
When to use a privileged user thread rather than a windows service? That's the question raised in a previous post . It was suggested that if the service needs to interact with a WinForms app...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.