none
Windows Service Started and then stopped

    Question

  • I have a windows service and it was working fine, and today I tried to stop it and unlike the usual stop process, this one took a longer time. The next time I want to start the windows service, it raise an error that the service started and then stopped, it also said that service with no job stops automatically. When I checked the event log, there is no event about my service. My service worked well yesterday, in fact, it worked as usual just before I tried to stop it . but then I don't know why the error appeared, I don't think I did any changes to the database..

    Any solutions ? or if someone can share his/her own problem similar to this

    What my windows service do: read a log file, write to log file, then access database, then execute a stored procedure in 2 hours interval..

    Edit: I even tried to restart my computer after the problem keep happening when i try to start the service, but it doesn't solve the problem.. now I cant start my service. One way I found to solve this problem is by re-installing the service. However, I need a better solution because I don't want to keep re-installing the service if this problem appeared.
    Saturday, July 22, 2006 3:12 PM

Answers

  • Solved that problem
    I cleared the event log, then it worked.. the application log was full so it couldn't start..
    Sunday, July 23, 2006 12:00 AM

All replies

  • It sounds like you need to check your OnStart() method within the service and make sure you've got a try/catch or other form of error detection code that can catch most issues and report them.
    Saturday, July 22, 2006 3:19 PM
    Moderator
  • I believe that is not the problem, because the first line of my code is to write to the eventlog, and it is not executed. Is it because the service is not really stopped, but then it is uninstalled, then the next time I install it, the service crashed ?

    edit: at the Event Viewer > System, I can see that the service started and then stopped everytime i tried to start it:
    - The Service1 service was successfully sent a start control.
    - The Service1 service entered the stopped state.
    However, all the actions inside onStart and onStop is not done..

    I even tried to create a simpler service, only to write to eventlog.. at first it works, then i cannot stop it, then the same problem appear.. I am sure that i have set the service to be "stoppable".

    Saturday, July 22, 2006 10:45 PM
  • Solved that problem
    I cleared the event log, then it worked.. the application log was full so it couldn't start..
    Sunday, July 23, 2006 12:00 AM
  • i tried cleaning up event logs and restart the windows service, still the problem persisits.
    Wednesday, January 03, 2007 4:03 PM
  • There can be uncaught exception when service starts - check Application event log
    Tuesday, February 27, 2007 4:26 AM
  • Hello,
    I need one solution by similar problem, help me!!!
    I presente similar problem en my server of productions,
    a service no started, I recived similar message : The <service> on local computer started and then stopped. some services stop automatically if they have no work to do for example, the performance logs and alerts service.
    I tried clearn event logs, but no show a new event, and message continued.

    see you
    thanks,
    Tuesday, November 24, 2009 4:14 PM
  • I tried clearing the Eventlog, but it still did not start up.

    I then thought i'll compare the permissions on the Executible Folder to another service someone else wrote.

    Once I added the SYSTEM user and gave him FULL permissions, all was working again.

    Monday, June 07, 2010 9:47 AM
  • "I tried clearing the Eventlog, but it still did not start up.

    I then thought i'll compare the permissions on the Executible Folder to another service someone else wrote.

    Once I added the SYSTEM user and gave him FULL permissions, all was working again."

     

    Can you please explain stepwisely how you applied this fix.

    Which directory/folder did you give full permission to?


    Saturday, June 26, 2010 2:13 AM
  • Hi,

        I am getting the same problem. I am using a WCF service, and hosting it on windows service with tcp protocol. I can not install it as Network service, i had installed it as local service. But when i use the same code from Windows form application it is working fine.

    Please reply if you get a solution to this

    Wednesday, July 21, 2010 12:55 PM