Windows service

hi guys,

i made a windows service that monitors the time spent on the internet. i can install it, run it, stop it with no problem.but the service doesn't run on windows startup. why even though i told it to start automatically. and in the "Services" window, it shows me that the startup type is automatic.

in the event log, everytime i start the windows, i see two errors:

-Timeout (30000 milliseconds) waiting for the Time Counter service to connect.

-The Time Counter service failed to start due to the following error:

The service did not respond to the start or control request in a timely fashion.

plz help me. :(



Answer this question

Windows service

  • Kamia111

    >>Private _netConnCol As New TimeCounter.NetworkConnectionCollection

    Not sure what the TimeCounter object is, but it seems to be exposing the NetworkConnectionCollection interface. The dependancies here are at the very least might include DNSClient, InternetSharing, and possibly the TCP/IP Netbios helper service.

    In any case, the fact that your service can be started manually, yet fails to start on reboot is a sure indicator that dependant services are not yet available.

    Ibrahim


  • Ian Barber

    the timecounter object is my service and the netconlib is a class included in my service.anyway i'll try to set the timeout longer than 30seconds.
  • Itzik Katzav

    i think i found the problem. i increased the servicepipetimeout to 180 seconds, and still my service didn't start. i noticed that after those three minutes passed, th service control manager launched the "application layer gateway" service(which controls the firewall and internet stuff). i think that my service depends on this one but windows insists on starting it after my service.

    the question is, how do i get my service to start after this one


  • mccpres

    Hi:

    You have to edit the registry to get what you want. I found this info for you:

    Dependencies - If your service is dependent on other services, you need to make sure this dependency information is set properly in the registry. Warning: improperly setting service dependency information in the registry could make a computer unbootable due to issues like circular dependencies - Service A cannot start before Service B and Service B cannot start before Service A - resulting in neither service ever starting. Be very careful here.

    Using RegEdt32 (RegEdit will not work here due to it’s inability to add REG_MULTI_SZ types), go to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\[YOUR SERVICE] and create a new value with a name of DependOnService and a data type of REG_MULTI_SZ. Set the data to the name of the key of the service your Windows service depends on. For example, if your Windows service depends on MSMQ the enter MSMQ since MSMQ is the name of the key in this services branch. If your Windows service depends on multiple services, add each service on its own line. If you are creating distribution media for your Windows service, you can include a .reg file which includes this information (easing deployment efforts).

    Ibrahim


  • zensunni

    no, my service doesn't display a UI. but it writes information to a log file.
  • Jim Stricker

    what dependencies

    all my service does is : use a timer and io.file.* and this is what's in the declarations:

    Imports System.ServiceProcess

    Imports System.Timers

    Inherits System.ServiceProcess.ServiceBase

    Implements NETCONLib.INetConnection

    Private x As Integer

    Private stopwatch As New csStopWatchClass.csStopWatch

    Private c As Integer

    Private tuy As Integer

    Private h As System.IO.StreamWriter

    Private _netConnCol As New TimeCounter.NetworkConnectionCollection

    my service doesn't depend on any other service.

    i think that the problem is the .NET runtime environment. i think if i write my service in c++, it will start. right


  • CJKeatley

    Do you display any UI inside your service startup code


  • mohammed barqawi

    ok thx i'll try that.

    thank you all for your help.:D


  • AlexBB

    You are experiencing an error in the service during system start up.

    My guess is that your service has dependencies that are not yet started and are noit available at startup time of your service, thus it throws an exception.

    Ibrahim Malluf


  • Windows service