Reputation: 11
i did set start my windows service or NT service like everybody says a then came up this message:
The service myService on local computer started an then stopped.Some services stop automatically if they are not in use by another services or programs
i've started other services and it never hapened... before i change the value of a parameter that have to find it's value on a web service method that look on a sql database...
and other change is that got formatted the hard disk...maybe i have to enable somethig please i need help
Upvotes: 1
Views: 1315
Reputation: 31
It happens most likely because you have an exception at startup... try to debug your things either by using a log or by trying to reproduce your behavior in a windows app....
You can even debug your windows service using the following method...
Write the following code in your Service file...
public void OnDebug()
{
OnStart(null);
}
In the program file,
YourService myService = new YourService();
myService.OnDebug();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
Upvotes: 1
Reputation: 5179
This can happen when the logic performed using a windows service exceeds the default timeout.
We cannot overcome the default timeout of a windows service. Usually windows services are used to instantiate a method. So start a child thread within the OnStart event of the windows service and call your method within it.
If this is not solving your issue, put the code in try catch and log the exceptions. This error can happen if there is any exception within OnStart event too.
Upvotes: 0