c++ - Windows service won't stop and restart -
i wrote windows service in c++ needs restart every night @ midnight, call exit(1) on can restarted scm. problem seems every other night starts partially , hangs. in event log, this:
application popup -application error: instruction @ "0x0043c145" referenced memory @ "0x00000035". memory not "read".
it seems fail right before opening odbc connection sql server 2008 database. can confirm service exits before restarts; nevertheless error every once in while when stops , restarts itself, if stop , restart service manually on , on can never fail, , if control process terminal port , exit manually there never fails either.
if try attach debugger process quits, can't glean useful information way either.
i'm tearing hair out trying figure out what's going on, don't know start. have ideas?
not direct answer if on vista(and afters think) there chance can try:
"a service notifies scm queue failure action entering service_stopped state , setting setserviceexitcode function's dwwin32exitcode parameter other error_success."
windows vista introduced new flag, failureactionsonnoncrashfailures, services set if want able notify scm initiate failure action: see more in vista services
Comments
Post a Comment