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

Windows Service - Dies during sleep

Hello:

I have had a program that checks LDAP to get a list of all the users
whose password will expire. I send these users an email letting them
know to change their passwords.

It had been working fine for months. Then, all of a sudden, something
changed and now the service dies unexpectedly. I wrote some code to
log what was the last step performed and it appears as though the
service dies while it is "sleeping".

Is there something on Windows that would try to kill my service? It
will usually run successfully once and then just die with an event
viewer log of "Faulting application, ..., faulting module unknown, ...

The error message is worthless and the log shows that everything ran
fine. Does anyone know what could be causing this to happen? Even
odder is the fact that is only seems to die on a production machine
and not on a test machine.

By the way, I originally wrote the service to work in a Thread.
However, in an attempt to resolve this issue, I am now using
System.Timers.Timer to do the same thing. The Thread always died
during Thread.Sleep and the Timer dies while time is passing. It is
just like something is killing my service.

Thanks,
Travis

Aug 20 '07 #1
3 5440
Hi Travis,

Instead of using System.Timers.Timer, try using System.Threading.Timer. This
timer is a much better fit for usage is environments like a windows
serverice. It should require very few changes to your code, and might solve
your problem.

Bennie Haelen (bh*****@statera.com)

"je**********@gmail.com" wrote:
Hello:

I have had a program that checks LDAP to get a list of all the users
whose password will expire. I send these users an email letting them
know to change their passwords.

It had been working fine for months. Then, all of a sudden, something
changed and now the service dies unexpectedly. I wrote some code to
log what was the last step performed and it appears as though the
service dies while it is "sleeping".

Is there something on Windows that would try to kill my service? It
will usually run successfully once and then just die with an event
viewer log of "Faulting application, ..., faulting module unknown, ...

The error message is worthless and the log shows that everything ran
fine. Does anyone know what could be causing this to happen? Even
odder is the fact that is only seems to die on a production machine
and not on a test machine.

By the way, I originally wrote the service to work in a Thread.
However, in an attempt to resolve this issue, I am now using
System.Timers.Timer to do the same thing. The Thread always died
during Thread.Sleep and the Timer dies while time is passing. It is
just like something is killing my service.

Thanks,
Travis

Aug 20 '07 #2
Hi,

Are you catching AppDomain.UnhandledException ? Maybe you are getting an
exceptio somewhere.

Also make sure to wrap your code in a try/catch

<je**********@gmail.comwrote in message
news:11**********************@x40g2000prg.googlegr oups.com...
Hello:

I have had a program that checks LDAP to get a list of all the users
whose password will expire. I send these users an email letting them
know to change their passwords.

It had been working fine for months. Then, all of a sudden, something
changed and now the service dies unexpectedly. I wrote some code to
log what was the last step performed and it appears as though the
service dies while it is "sleeping".

Is there something on Windows that would try to kill my service? It
will usually run successfully once and then just die with an event
viewer log of "Faulting application, ..., faulting module unknown, ...

The error message is worthless and the log shows that everything ran
fine. Does anyone know what could be causing this to happen? Even
odder is the fact that is only seems to die on a production machine
and not on a test machine.

By the way, I originally wrote the service to work in a Thread.
However, in an attempt to resolve this issue, I am now using
System.Timers.Timer to do the same thing. The Thread always died
during Thread.Sleep and the Timer dies while time is passing. It is
just like something is killing my service.

Thanks,
Travis

Aug 20 '07 #3
On Aug 20, 12:29 pm, "Ignacio Machin \( .NET/ C# MVP \)" <machin TA
laceupsolutions.comwrote:
Hi,

Are you catching AppDomain.UnhandledException ? Maybe you are getting an
exceptio somewhere.

Also make sure to wrap your code in a try/catch

<jehugalea...@gmail.comwrote in message

news:11**********************@x40g2000prg.googlegr oups.com...
Hello:
I have had a program that checks LDAP to get a list of all the users
whose password will expire. I send these users an email letting them
know to change their passwords.
It had been working fine for months. Then, all of a sudden, something
changed and now the service dies unexpectedly. I wrote some code to
log what was the last step performed and it appears as though the
service dies while it is "sleeping".
Is there something on Windows that would try to kill my service? It
will usually run successfully once and then just die with an event
viewer log of "Faulting application, ..., faulting module unknown, ...
The error message is worthless and the log shows that everything ran
fine. Does anyone know what could be causing this to happen? Even
odder is the fact that is only seems to die on a production machine
and not on a test machine.
By the way, I originally wrote the service to work in a Thread.
However, in an attempt to resolve this issue, I am now using
System.Timers.Timer to do the same thing. The Thread always died
during Thread.Sleep and the Timer dies while time is passing. It is
just like something is killing my service.
Thanks,
Travis- Hide quoted text -

- Show quoted text -
The entire application is wrapped in a giant try/catch and it catches
a generic Exception. However, if an error did occur, than I would see
it in my event viewer. However, my log shows that everything completed
successfully. So, I can say with utmost certainty that is not
something in my code that causing the service to die.

I am wondering if there is some sort of issue on the server . . . and
it doesn't help that the service dies at seemingly random times -
usually within 5 minutes.

Aug 20 '07 #4

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

Similar topics

29
by: Ken Allen | last post by:
I have a number of services developed in C# (.Net), and they have been working fine for the most part. Recently someone reported that ipon occassion (originally rarely, but more frequently on some...
1
by: benmorganpowell | last post by:
I have a small windows service which connects to a POP3 server at defined intervals, scans the available messages, extracts the required information and inserts the data into a SQL database. I am...
5
by: Amueerie | last post by:
is there a way to stop windows from going to sleep? i tried to check if there is a setting for this, but no. during presentations or discussions, my computer goes to sleep & then i have to login...
4
by: Lemune | last post by:
Hello everyone. I'm using vb 2005. I'm creating program that run as service on windows. And in my program I need to use timer, so I'm using timer object from component. I try my source code on...
12
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...
4
by: =?Utf-8?B?TWFyaw==?= | last post by:
Hi... Following the samples online, we implemented a windows service in .Net. Like most services, there's a worker thread actually doing stuff in the background. The problem we've run into is...
9
by: jehugaleahsa | last post by:
Hello: I am working on a service. For the past month we have been simply restarting the service daily (which defeats the point). I have been putting some extra time into it today and have come...
4
by: Steven De Smet | last post by:
Hello, This is my first post. I searched on the internet for answers but I was unable to solve my problem. So I hope that you guy's can help me with my VB.NET problem I tried to create a...
10
by: tshad | last post by:
I have a Windows Service that I need to put to sleep for about 10-20 minutes. The problem is that if you try to shut it down during this time, it will tell you that the service didn't respond in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.