VB.NET service stuck in "starting" mode?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone

I am trying to write a fairly simple VB.NET service (use a timer to poll a network location for a file, if file exists, send message)

The service correctly starts, stops, runs the timer, etc. I can tell this from a custom event log I created, and it adds new entries on start, stop, and each time the timer expires

FYI...sice this is my first service to write, I'm going by the MSDN article at http://msdn.microsoft.com/library/d...lkthroughcreatingwindowsserviceapplication.as

OK, back to topic...when I try to start my service (My Computer --> Manage --> Services & Applications --> Services --> Right-click my service and click "Start"), the progress bar window that appears never completely finishes. I loads the first 50% or so just fine, then does the rest VERY slowly, and never closes. However, if I click "Close", my service status says "Starting", but it is writing entries to the event log as the timer expires, so it is running

Is there something in my code I'm doing wrong that makes it think it never finished loading the service (although it did)

Thanks in advance


Protected Overrides Sub OnStart(ByVal args() As String

logMain.WriteEntry("Service started.", EventLogEntryType.Information

' Setup time
timeQuery.AutoReset = Tru
' Set for testing. Increase time for deployment
timeQuery.Interval = 600

' Start time
timeQuery.Start(

End Su


PS - If you think this should be or would get more responses in a different topic, please let me know..
 
Hi,

My assumption here is that timeQuery is a Timer instance. If that's the
case, do you get the same behavior if you change the "timeQuery.Start" to
"timeQuery.Enabled = true"?

As an aside, since you're looking for files, you may get some benefit out of
the FileSystemWatcher class. You can set the FilterString property to a
specific file name, if you're looking for a specific file, or leave it blank
(String.Empty) if you are just looking for the existence of any file in a
target directory. An excellent example of this kind of service can be found
in the "Coding Techniques for Microsoft Visual Basic .NET" book (chapter 9).

HTH,
Derrick

pillbug22 said:
Hi everyone-

I am trying to write a fairly simple VB.NET service (use a timer to poll a
network location for a file, if file exists, send message).
The service correctly starts, stops, runs the timer, etc. I can tell this
from a custom event log I created, and it adds new entries on start, stop,
and each time the timer expires.
FYI...sice this is my first service to write, I'm going by the MSDN
article at
http://msdn.microsoft.com/library/d...kthroughcreatingwindowsserviceapplication.asp
OK, back to topic...when I try to start my service (My Computer -->
Manage --> Services & Applications --> Services --> Right-click my service
and click "Start"), the progress bar window that appears never completely
finishes. I loads the first 50% or so just fine, then does the rest VERY
slowly, and never closes. However, if I click "Close", my service status
says "Starting", but it is writing entries to the event log as the timer
expires, so it is running.
Is there something in my code I'm doing wrong that makes it think it never
finished loading the service (although it did)?
Thanks in advance-



Protected Overrides Sub OnStart(ByVal args() As String)

logMain.WriteEntry("Service started.", EventLogEntryType.Information)

' Setup timer
timeQuery.AutoReset = True
' Set for testing. Increase time for deployment.
timeQuery.Interval = 6000

' Start timer
timeQuery.Start()

End Sub




PS - If you think this should be or would get more responses in a
different topic, please let me know...
 
Thanks for the thoughts...


I reduced my code to only enter an event in the log, and it still hangs up when starting.

I can click the "Close" button once it appears to hang and the status shows "Starting", but I can view the event log and see the entry from the OnStart code.

I've tried starting the service then attaching the debugger, but nothing comes up (nothing happening?).

Wierd...




Protected Overrides Sub OnStart(ByVal args() As String)

logMain.WriteEntry("Web TrackIt Alerts", "Service started.", EventLogEntryType.Information, 0)

' Start timer
'timeQuery.Enabled = True

End Sub
 
Back
Top