Jump to content
Excelsior Forums
leesouth

Service started then stopped

Recommended Posts

I have a problem with an NT service I?ve compiled using Jet. I have compiled and deployed the service with no problems but when I try and start it I get the error message: The service started and then stopped.

My application runs fine through Eclipse and will also output the messages from the main class to the event logger but I cannot see why the service will not stay started. I did make some progress making the service sleep for a short period of time but I want the service permanently started without coding infinite loops.

I wonder if I?m just missing a class or something?

Has anyone encountered this problem before or does anyone have any ideas on how I can diagnose the problem.

Share this post


Link to post
Share on other sites

I had read the article mentioned but this line obviously points to my problem: "If you wish your service program to wait for a proper exit of other threads, you should implement that programmatically in the run() method"

Does anyone have any suggestions about how I programmatically implement this? Do most people use the sleep or wait methods of the thread class?

Share this post


Link to post
Share on other sites

I have discovered after much trial and error in MS Visual Studio.NET that you get the "started and then stopped" message if you don't make the ServiceName in Service.InitializeComponent to be identical to the name in the ProjectInstaller. Perhaps your problem is similar.

Share this post


Link to post
Share on other sites

Included all of the 'JET  Runtime' during the JetPack Step 5 (of 10).  After including all the JET RT and reinstalling the new setup package... does your service still start and stop right away?

if it still does, its most likely something in your code, in which case you should put a Event log message at certain points in your code to see where execution stops.

Hope it helps!

-Eric

Share this post


Link to post
Share on other sites

×