Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

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
0
BobsExEx
Asked:
BobsExEx
1 Solution
 
skyDaemonCommented:
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.

0
 
RainUKCommented:
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?
0
 
BobsExExAuthor Commented:

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
0
 
moduloCommented:
Dear expert(s),

A request has been made to close this Q in CS:
http://www.experts-exchange.com/Community_Support/Q_20561506.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
0
 
moduloCommented:
Saving this Q as a PAQ and refunding the points to the questionner

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now