views:

90

answers:

2

I have created a windows service in C#.NET that is continuously running. Now when i stop it from the services.msc initially it shows that it has been stopped but after some time when i refresh the services.msc it shows as started again. I also checked in the task manager at the same time, i see that the exe of my application gets killed but starts on its own again.

Please help.

A: 

If you take a look into the properties of your service, there is a tab called Recovery. Maybe there is something configured on this page which automatically restarts the service.

Maybe you can use Process Monitor to find out a little more about who starts your service?

Oliver
Where do i look for the tab called Recovery that you are talking about. Its not present in the properties of the Service that i have created.
Snowill
@Snowill Start->Control Panel->Admin. Services->Services.Right click on a specific service, click Properties and one of the tabs at the top should say Recovery.
AndyC
It says "Take no action" for all three types of failures specified.
Snowill
I tried creating a sample Windows service in C# and still i am facing the same issue. When i start the service from 'Services' it starts fine but when i try to stop it manually from 'Services' it stops but starts up again immediately.
Snowill
@Snowill: Can you add your sample code to your question?
Oliver
I think recovery would only apply if the service was stopping unexpectedly (i.e. crashing). Manually stopping the process is normal. All I can think is that another process is asking to have the service started again.
Chris Smith
A: 

I suppose this was something to do with the operating system. I deployed my service on Win2k3 and it worked just fine. It started perfectly and stopped when i stopped it from Services.msc. I was trying to deploy the service on WinXP earlier. Please let me know if anyone else has faced such an issue.

Snowill