Custom NT Service not starting correctly

Posted on 2003-03-21
Medium Priority
Last Modified: 2012-05-04

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?

Question by:BobsExEx
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8184677
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.


Expert Comment

ID: 8185700
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?

Author Comment

ID: 8198119

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


Expert Comment

ID: 8198492
Dear expert(s),

A request has been made to close this Q in CS:

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.


Community Support Moderator
Experts Exchange

Accepted Solution

modulo earned 0 total points
ID: 8221585
Saving this Q as a PAQ and refunding the points to the questionner


Community Support Moderator
Experts Exchange

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question