none
Windows service gives "Error 1053: The service did not respond to the start or control request in a timely fashion" while start

    Question

  • Hi Experts....

    I have unique problem while deploying Windows service build on Microsoft Framework 1.1. When i am deploying this service at a particular machine, i am getting error "Error 1053: The service did not respond to the start or control request in a timely fashion.", but able to deploy the same service at other machines. On other machines i am not getting this error. We are into deployment stage and facing this problem on perticular that machine only. This machine is a Windows XP professional machine only. I have searched on web also they have stated that this might be problem with application log is full or any dependency is missing. but after trying all options that problem persists as it is. we are using thread into this service....

    I am giving the code snipet below. Can any one help me into this????

    Public Sub New()

    MyBase.New()

    ' This call is required by the Component Designer.

    InitializeComponent()

    ' Add any initialization after the InitializeComponent() call

    Wr = New StreamWriter("d:\LOG.txt", True)

    objMain = New MainClass

    End Sub

     

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

    ' Add code here to start your service. This method should set things

    ' in motion so your service can do its work.

    Wr.WriteLine(Now & " Service started ")

    Wr.Flush()

    flag = True

    ThreadUploadXML = New Thread(AddressOf objMain.UploadImages)

    ThreadUploadXML.Start()

    End Sub

    Thanks in Advance

    Wednesday, February 22, 2006 9:15 AM

Answers

  • Hi,

    It seems that an exception is raised on your OnStart. First thing that I can see is that you are trying to write a file "d:\LOG.txt", this means that the user that is using the service needs to have permissions to do this, otherwise it will raise a security exception and your service will be terminated.

    The less likely is that you always have to query if (ThreadUploadXML != null) then start it, the OS sometimes can have some Threads limitation raising another exception.

    What I recommend in order to detect what is going on is simply put your OnStart code on a try,catch context. If an exception is raised just publish it on the event viewer.

     

    Hope this helps.

    Salva

    Thursday, February 23, 2006 2:47 PM

All replies

  • Hi,

    It seems that an exception is raised on your OnStart. First thing that I can see is that you are trying to write a file "d:\LOG.txt", this means that the user that is using the service needs to have permissions to do this, otherwise it will raise a security exception and your service will be terminated.

    The less likely is that you always have to query if (ThreadUploadXML != null) then start it, the OS sometimes can have some Threads limitation raising another exception.

    What I recommend in order to detect what is going on is simply put your OnStart code on a try,catch context. If an exception is raised just publish it on the event viewer.

     

    Hope this helps.

    Salva

    Thursday, February 23, 2006 2:47 PM
  • Have you looked in the application portion of the system event log?  I was recently writing a service and exceptions that I didn't catch in the OnStart() method which were causing the same problem you are having were written to it.


    -Mark
    Thursday, February 23, 2006 4:28 PM
  • Cause

    This issue is Microsoft-related. The ServiceBase class calls the method directly from the Service command handler defined in the ScDispatcherLoop of the Advapi32.dll file. After 30 seconds, if the ScDispatcherLoop thread is not ready to receive a new service command from the Service Control Manager, the Windows Service Controller marks the service as time out. Therefore, you receive the error message.

     

    Resolution

    To resolve this problem, obtain the latest service pack for the Microsoft .NET Framework 1.1.

     

    May your eventlog is full, if so clear it first

     

    if possible do not put any code in onstart method rather use timer to do desired process after service start

     

     i m sure , after that u never ever face this problem.
    Friday, July 13, 2007 12:36 PM