473,396 Members | 1,706 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,396 software developers and data experts.

Windows service with timer doesn't work in Windows 2003 server

Hi all,

I have developed a windows service using the windows service project
template in VS.NET. I have used three controls in the service, a timer,
performance counter and a message queue control. The service will "sleep"
for 'n' seconds using the timer control and whenever the timer_elapsed event
occurs, I use the performance counter object to determine availability of
few resources. Based on the availability of resources, I use the message
queue control to put messages into a local private queue. The service uses
LocalService account and reads a few registry keys in the OnStart() method
and then waits for the timer_elapsed event.

The issue is the all too familiar "it works on my system" kind!! It works
perfectly fine in my development system (installed using installutil) which
is a WinXP SP2 with .Net 1.1.4322 and the timer also gets triggered
properly. But when I install the same service in a Windows 2003 server the
timer never gets triggered!! The server also has the same version of .Net
framework but I'm just lost as to why the timer doesn't get triggered
there!! There are no errors/warnings generated in the event log too so its
all the more confusing. I also tried creating a setup project with custom
actions and then installed the same in the Win2003 server but the
timer_elapsed event never gets triggered!!

Replies will be very helpful!! Btw, I have set the AutoReset property of
the timer control to false to have control over when the timer starts
ticking again, but I have made sure that I start off the timer
appropriately.

Thanks
Dhilip Kumar
Nov 16 '05 #1
5 5065
Silly question but you are using a System timer and not a form's timer
right?

Also, what, if any, additional processing does the service do that might
be causing a security issue under the server environment. I agree,
service debugging is a pain.

What I do, while making the code a pain in the ass to read, is add
literally about 100 of these

#if _SERVICE_DEBUG_
eventLog.Additem("[method]::[counter]");
#endif

so that I will see "eventLog.Additem("_addHash::11");" in my code and
about 5-6 lines below that "eventLog.Additem("_addHash::12");".

It's a sad yet, fully workable way to watch line by line count what is
going on log wise in the service. When you see 10.11.12.. and no more
numbers, it pins down the cause between 12 and 13. When your finished
just undefine the pragma and recompile to get rid of the tracking.

Dhilip Kumar wrote:
Hi all,

I have developed a windows service using the windows service project
template in VS.NET. I have used three controls in the service, a timer,
performance counter and a message queue control. The service will "sleep"
for 'n' seconds using the timer control and whenever the timer_elapsed event
occurs, I use the performance counter object to determine availability of
few resources. Based on the availability of resources, I use the message
queue control to put messages into a local private queue. The service uses
LocalService account and reads a few registry keys in the OnStart() method
and then waits for the timer_elapsed event.

The issue is the all too familiar "it works on my system" kind!! It works
perfectly fine in my development system (installed using installutil) which
is a WinXP SP2 with .Net 1.1.4322 and the timer also gets triggered
properly. But when I install the same service in a Windows 2003 server the
timer never gets triggered!! The server also has the same version of .Net
framework but I'm just lost as to why the timer doesn't get triggered
there!! There are no errors/warnings generated in the event log too so its
all the more confusing. I also tried creating a setup project with custom
actions and then installed the same in the Win2003 server but the
timer_elapsed event never gets triggered!!

Replies will be very helpful!! Btw, I have set the AutoReset property of
the timer control to false to have control over when the timer starts
ticking again, but I have made sure that I start off the timer
appropriately.

Thanks
Dhilip Kumar

Nov 16 '05 #2
Greg,

Thanks very much for your reply. Yes, it was a security issue! The timer
control I used was a server timer, but I was using Local Service account. I
changed it to LocalSystem it worked! Interesting, because I don't recollect
seeing any security precautions in the documentation while using the server
timer!!

Dhilip Kumar

"Greg Merideth" <be*****@forwardtechnology.net> wrote in message
news:41**************@forwardtechnology.net...
Silly question but you are using a System timer and not a form's timer
right?

Also, what, if any, additional processing does the service do that might
be causing a security issue under the server environment. I agree,
service debugging is a pain.

What I do, while making the code a pain in the ass to read, is add
literally about 100 of these

#if _SERVICE_DEBUG_
eventLog.Additem("[method]::[counter]");
#endif

so that I will see "eventLog.Additem("_addHash::11");" in my code and
about 5-6 lines below that "eventLog.Additem("_addHash::12");".

It's a sad yet, fully workable way to watch line by line count what is
going on log wise in the service. When you see 10.11.12.. and no more
numbers, it pins down the cause between 12 and 13. When your finished
just undefine the pragma and recompile to get rid of the tracking.

Dhilip Kumar wrote:
Hi all,

I have developed a windows service using the windows service project
template in VS.NET. I have used three controls in the service, a timer,
performance counter and a message queue control. The service will
"sleep" for 'n' seconds using the timer control and whenever the
timer_elapsed event occurs, I use the performance counter object to
determine availability of few resources. Based on the availability of
resources, I use the message queue control to put messages into a local
private queue. The service uses LocalService account and reads a few
registry keys in the OnStart() method and then waits for the
timer_elapsed event.

The issue is the all too familiar "it works on my system" kind!! It
works perfectly fine in my development system (installed using
installutil) which is a WinXP SP2 with .Net 1.1.4322 and the timer also
gets triggered properly. But when I install the same service in a
Windows 2003 server the timer never gets triggered!! The server also has
the same version of .Net framework but I'm just lost as to why the timer
doesn't get triggered there!! There are no errors/warnings generated in
the event log too so its all the more confusing. I also tried creating
a setup project with custom actions and then installed the same in the
Win2003 server but the timer_elapsed event never gets triggered!!

Replies will be very helpful!! Btw, I have set the AutoReset property of
the timer control to false to have control over when the timer starts
ticking again, but I have made sure that I start off the timer
appropriately.

Thanks
Dhilip Kumar

Nov 16 '05 #3

"Dhilip Kumar" <dd*****@gmail.com> wrote in message
news:u7**************@TK2MSFTNGP10.phx.gbl...
Greg,

Thanks very much for your reply. Yes, it was a security issue! The timer
control I used was a server timer, but I was using Local Service account.
I changed it to LocalSystem it worked! Interesting, because I don't
recollect seeing any security precautions in the documentation while using
the server timer!!

Dhilip Kumar


There are no security issues associated, both LocalSystem and Local service
should work.
What scares me a bit is that you are talking about a "Time Control" using
"server timer", mind to explain exactly what control you are talking about?
More importantly, what timer class are you using?

Willy?

Nov 16 '05 #4
Willy,

I am using timer instance from the Server.Timers namespace. I hope that
should be fine!

Dhilip

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...

"Dhilip Kumar" <dd*****@gmail.com> wrote in message
news:u7**************@TK2MSFTNGP10.phx.gbl...
Greg,

Thanks very much for your reply. Yes, it was a security issue! The
timer control I used was a server timer, but I was using Local Service
account. I changed it to LocalSystem it worked! Interesting, because I
don't recollect seeing any security precautions in the documentation
while using the server timer!!

Dhilip Kumar


There are no security issues associated, both LocalSystem and Local
service should work.
What scares me a bit is that you are talking about a "Time Control" using
"server timer", mind to explain exactly what control you are talking
about?
More importantly, what timer class are you using?

Willy?

Nov 16 '05 #5
Guess you mean System.Timers namespace. Using this kind of timers should
work without a problem irrespective the security context.
I'm sure you hit another issue with your service.

Willy.

"Dhilip Kumar" <dd*****@gmail.com> wrote in message
news:uV****************@TK2MSFTNGP10.phx.gbl...
Willy,

I am using timer instance from the Server.Timers namespace. I hope that
should be fine!

Dhilip

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...

"Dhilip Kumar" <dd*****@gmail.com> wrote in message
news:u7**************@TK2MSFTNGP10.phx.gbl...
Greg,

Thanks very much for your reply. Yes, it was a security issue! The
timer control I used was a server timer, but I was using Local Service
account. I changed it to LocalSystem it worked! Interesting, because I
don't recollect seeing any security precautions in the documentation
while using the server timer!!

Dhilip Kumar


There are no security issues associated, both LocalSystem and Local
service should work.
What scares me a bit is that you are talking about a "Time Control" using
"server timer", mind to explain exactly what control you are talking
about?
More importantly, what timer class are you using?

Willy?


Nov 16 '05 #6

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

Similar topics

2
by: cd | last post by:
Is there a specific process or permissions that must be granted to get a .NET (framework 1.4) Window Service to run properly on a Windows 2003 Server? I built a Windows Service to start two local...
4
by: Groundskeeper | last post by:
I can't seem to get a custom UnhandledException handler working for a Windows Service I'm writing in VB.NET. I've read the MSDN and tried various different placements of the AddHandler call, to no...
3
by: Trevor | last post by:
This is driving us mad - please help! Back in 2003, I coded a Windows Service in VB.NET for framework v1.1.4322. I deployed it in Nov. 2003, and it worked fine until the end of May 2005, when it...
2
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer...
5
by: Tom | last post by:
Using multiple System.Timers.Timer objects in a Windows Service for performing multi-thread activities in a periodic fashion. Timers are AutoReset=false, to only have a single timer execution...
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...
10
by: dermot | last post by:
I have wrriten a small windows service application in visual studio ..net 2003 which listens for incoming FTP files. These files would overwrite over time due to duplicate file names. However any...
6
by: DM | last post by:
Hi All, I have written a server program which distributes real-time data to our customers and is also used by our customers to redistribute this data over their internal networks. The program is...
8
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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.