Results 1 to 3 of 3

Thread: VB.NET service always in "starting" mode

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    7

    VB.NET service always in "starting" mode

    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 start, 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...since this is my first service to write, I'm going by a MSDN article I found on the subject.

    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-


    Code:
        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

  2. #2
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    Have you tried running the debugger on your service and stepping thru it?

    Tools, Debug Process, select the service, and click attach iirc.

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2004
    Posts
    7
    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...


    VB Code:
    1. Protected Overrides Sub OnStart(ByVal args() As String)
    2.  
    3.         logMain.WriteEntry("Web TrackIt Alerts", "Service started.", EventLogEntryType.Information, 0)
    4.  
    5.         ' Start timer
    6.         'timeQuery.Enabled = True
    7.  
    8. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width