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.
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".
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.
"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?
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