Link to home
Start Free TrialLog in
Avatar of BobsExEx
BobsExEx

asked on

Custom NT Service not starting correctly


I have written a .exe program to run as a service.
For some reason, it will not start correctly.  I have installed the Microsoft NT Service Control and I call it and it says that it installed correctly according to a log I am writing to but then I get a message from the Services window (where I am trying to start from) that says,

"Could not start the CustomService service on Local Computer.  The service did not return an error.  This could be an internal Windows error or an internal service error.  If the problem persists, contact your system administrator."

The process in the program is:
Check command line arguments.
Attempt to start the service.
If successful, interval and enable a timer to perform tasks.

BAM!  It stops.  It never gets to do anything else.  What I need is to figure out what the problem is but I don't get feedback and I am not trapping any errors.

Any ideas on how to go about solving this?

Bob
Avatar of skyDaemon
skyDaemon

Place msgbox's all over your service code to see where it broke.  The equivalent of "here 1", "here 2" maybe with some varible info etc. Or, do the same thing but write output to a file as you're going.  You're down to the manual way it sounds like.

Or you could paste your code up here if you want someone else to look at it.

Well can you paste the code that sets the timer off here? The whole subroutine.

Also are you relying on any other services to start up before your service starts?

Also what type of service have you installed it as? e.g. Local System Account (Interactive enabled/disabled) or is it under Domain Account?
Avatar of BobsExEx

ASKER


Well I have found what it takes to get this thing to start.  I found it by disassembling a program that DOES start as a service, piece by piece, running it after each change...

Anyway, the NT Service Control has a related "Start" subroutine.  When this event is omitted OR the "Success= True" statement is not within the subroutine, the service won't start successfully.  I am sure that anyone would want to put more checking inside this event but right here is the make or break code to getting my service running.  As Follows:
==================================================
Private Sub ctlService_Start(Success As Boolean)
    Success = True
End Sub
==================================================

Bob
Dear expert(s),

A request has been made to close this Q in CS:
https://www.experts-exchange.com/questions/20561506/Closing-Questions.html

Without a response in 72 hrs, a moderator will finalize this question by:

 - Saving this Q as a PAQ and refunding the points to the questionner

When you agree or disagree, please add a comment here.

Thank you.

modulo

Community Support Moderator
Experts Exchange
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial