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

Loop in Window Service

Hi,

I wrote a window service in VB6, where I used a loop to continue check
something. Now, I transfer it into vb.NET. I can setup service with a mis
file, but when I start the service, it takes a while to complete and gives at
the end an error. As long as I remove the loop (a single run) it works
properly. Anyone can give an explanation and solution. How to a window
service in a continue way.

Thanks
Nov 21 '05 #1
3 1388
This is a bug of FW 1.1 I found this link to fix
http://support.microsoft.com/?kbid=839174

"Li Pang" wrote:
Hi,

I wrote a window service in VB6, where I used a loop to continue check
something. Now, I transfer it into vb.NET. I can setup service with a mis
file, but when I start the service, it takes a while to complete and gives at
the end an error. As long as I remove the loop (a single run) it works
properly. Anyone can give an explanation and solution. How to a window
service in a continue way.

Thanks

Nov 21 '05 #2
"Li Pang" <Li****@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
when I start the service, it takes a while to complete and gives at
the end an error.


Your service should do /as little as possible/ in the OnStart routine,
preferably just starting a [one-off] Timer from whose Timer Event the
Real Work gets started.
This allows the OnStart routine to return (to the Service Control
Manager) more quickly, preventing this error.

Sub OnStart()
tmrRunner.Interval = 500
tmrRunner.Enabled = True
End Sub

Sub tmrRunner_Timer
tmrRunner.Enabled = False

Do While True
' Do the Real Job
End Do

End Sub

HTH,
Phill W.
Nov 21 '05 #3
Hi Phill. W,
FW 1.1 SP1 can't help to resolve the problem, but using a timer seems very
useful. Thanks for your suggestion.

"Phill. W" wrote:
"Li Pang" <Li****@discussions.microsoft.com> wrote in message
news:AF**********************************@microsof t.com...
when I start the service, it takes a while to complete and gives at
the end an error.


Your service should do /as little as possible/ in the OnStart routine,
preferably just starting a [one-off] Timer from whose Timer Event the
Real Work gets started.
This allows the OnStart routine to return (to the Service Control
Manager) more quickly, preventing this error.

Sub OnStart()
tmrRunner.Interval = 500
tmrRunner.Enabled = True
End Sub

Sub tmrRunner_Timer
tmrRunner.Enabled = False

Do While True
' Do the Real Job
End Do

End Sub

HTH,
Phill W.

Nov 21 '05 #4

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

Similar topics

6
by: Usman | last post by:
Hi I have a window service written in C#. I have another application that requires a lengthy process to be performed like taking backup. How can I make this lengthy process be performed by...
4
by: utkarsh | last post by:
Hi, I want to develop a Window Service in C# that should be capable of sisplaying the a icon in the window tray. Based on some logic in service, icon should be changed to some other...
4
by: outforblood74 | last post by:
Ok here's the deal, the for each statment using VB 6 doesn't loop all the objects. I would like it to close all the IE browsers that are open, but it doesn't work. And now I'm concerned that its...
12
by: eyoung | last post by:
Can someone tell me what I've done wrong here...this kinda works...but no cigar! I want to loop threw each "Service Number" and get all entries before going on to the next. What looks something...
8
by: Dave | last post by:
I am trying to write an event-driven application with no main window that runs "forever". It waits on a named event and then displays a window depending on data pased in a memory-mapped file. I...
1
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have created a very simple window service. This window service in turn is calling a function that exist in a windows form. When I am trying to run this windows service. window...
7
by: =?Utf-8?B?Vmlua2k=?= | last post by:
public void sendKeysTest() { Process myProcess = Process.Start(@"C:\winnt\system32\cmd.exe"); SetForegroundWindow(myProcess.Handle); if (myProcess.Responding) SendKeys.SendWait("{ENTER}");...
0
by: henkya | last post by:
Language Used: C# Project Typed: Setup Project (for .NET Window Service) Hi Bump into this issue and seriously have a hunch that this is a bug in the .NET setup project. These are the scenario:...
2
by: gray d newbie | last post by:
Greetings All, This is my first time creating a Window Service and I am having this error message when I try to start my window service (currently known as Service1). Below is my code for Window...
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
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
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.