开发者

Windows service not starting

开发者 https://www.devze.com 2023-04-11 03:13 出处:网络
I created a windows service using Windows SC.exe and following this , I am facing following issues: I am unable to start the service it gives error (Error 1053: The service did not respond to the st

I created a windows service using Windows SC.exe and following this , I am facing following issues:

  1. I am unable to start the service it gives error (Error 1053: The service did not respond to the start or control request in a timely fashion.)
  2. I want to set the recovery option of service on failure to restart it (I want to do it 开发者_如何学JAVAwhile creating the service itself and dont want to goto services.msc and do it manually.)

regarding the first point i guess its related to working directory because i havent set any working directory for the same and the application requires some depending files that are placed with the exe file itself.


  1. The working directory of service is always System32. This is not configurable. You will need to ensure that any dependencies that are not in System32 the service is able to load. For the static dependencies, usually it is sufficient to look up the error record in system event log (eventvwr.msc). If you post more details on what kind of dependencies (e.g. managed/unmanaged/run time) you have I would be able to give more specific solution.

  2. Recovery options for service are configurable using sc.exe:


c:\>sc failure /?
DESCRIPTION:
        Changes the actions upon failure
USAGE:
        sc <server> failure [service name] <option1> <option2>...

OPTIONS:
        reset=   <Length of period of no failures (in seconds)
                  after which to reset the failure count to 0 (may be INFINITE)>
                  (Must be used in conjunction with actions= )
        reboot=  <Message broadcast before rebooting on failure>
        command= <Command line to be run on failure>
        actions= <Failure actions and their delay time (in milliseconds),
                  separated by / (forward slash) -- e.g., run/5000/reboot/800
                  Valid actions are <run|restart|reboot> >
                  (Must be used in conjunction with the reset= option)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号