469,950 Members | 2,328 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,950 developers. It's quick & easy.

Windows Service Has Nothing To Do Error

June 16, 2005

I'm creating a Windows Service that will backup some statistics files
for my web application. I am having a problem when I try to start my
service, where it says something about that the service started and stopped
and sometimes this is caused by the service not having work to do. It
mentioned that the Peformance Logs & Alerts service has this problem....
What I am wanting to do is in OnStart, to create a new thread and then have
that thread continuely (with .Sleep to create intervals) process a method
that backs up my files. When I do this, I don't get the stopped/started
service message, but no code ever gets executed in the method that the
thread runs. When I just try to implement it in the OnStart method itself
and not using another thread, then I get an error about that the service
couldn't be started in a timely fashion. If I implement it in the OnStart
and not have intervals, then I get the nothing to do message.... I am
greatly confused by this and would GREATLY appreciate any help! I'm sure
that I'm doing something wrong that is very obvious, but I haven't been able
to figure out what. Basically, the code looks like:

OnStart Method

dim th as new thread(addressof Backup)

Backup Method

do while true
dim reader as new streamreader(filepath)
dim writer as new streamwriter(newfilepath)

th.sleep(new timespan(0,5,0))

Any thoughts would be greatly appreciated! Thanks and have a great day!

Joseph Bittman
Microsoft Certified Application Developer

Web Site:
Dynamic IP -- Check here for future changes
Nov 21 '05 #1
1 1700
Why are you using 'TimeSpan' in your th.Sleep?

You could just say: 'th.Sleep(500)'

When you close the StreamWriter objects they are not fully distroyed

Any chance of the rest of the code to see?

Where do you get the file/directory paths from?

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Ger | last post: by
4 posts views Thread by tshad | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.