Question

Right now i have some sort of services application on windows server 2003 for inputting data from devices into database.

Sometimes the services fail due to data error or anything else (database connection problem, internet connection down, etc) which i have to restart the services, right now the solution i provide for this problem was a simple batch command using NET START/STOP command that scheduled every 1 hour.

I then take a look at recovery tab on service properties, there was an option to restart the services, which i want to know was how to test it? Such as, how Windows know the services was failed? And the most important was how to know that services successfully restarted when failure occur (based on recovery setting)?

PS: I didn't have access to the code

Thanks

Was it helpful?

Solution

The service console's auto restart kicks in when a service crashes from an unhandled exception. (Some part of your code throws an exception, but nothing catches it, and it bubbles all the way up and out of the main function.)

If you have control over the code, it might be better to put in some try/catch blocks around the areas that tend to cause problems and handle errors more gracefully. You could also put a try/catch around the main entry point of the application, to catch and try to handle any unhandled exceptions from the code.

If you can't control the code, you can test the auto service recovery by forcing one of these errors to occur. If you service crashes in the event of a connection problem, you can force this by unplugging the network cable on the computer.

OTHER TIPS

The easiest way to test the recovery options is to kill your service's process from the task manager. Windows will detect it and run the First Failure recovery option. Subsequent kills will test the Second Failure and Subsequent Failure options. The Event Log will note the exit and the actions taken.

Depending on your environment and your service this may or may not be a viable option for you as you are killing the service.

You can restore it back to an earlier point in time, Restoring Surface doesn’t change your personal files, but it might remove recently installed apps and drivers.

1.Swipe in from the right edge of the screen, and then tap Search. (If you're using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, then click Search.)

2.Enter Control Panel in the search box, and tap or click Control Panel.

3.Enter Recovery in the Control Panel search box, and then tap or click Recovery.

4.Tap or click Open System Restore, and then follow the instructions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top