Re: NT Service Problem
- From: "Pete Delgado" <Peter.Delgado@xxxxxxxxx>
- Date: Tue, 12 Sep 2006 11:14:58 -0400
"Susanna" <Susanna@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5FA89596-956E-40C1-AF75-E2A5EAE5B593@xxxxxxxxxxxxxxxx
You've got it right , the problem is with not terminating the threads.
I'll try doing a terminatethread on stop.
Also I dont know how to attach a debugger to NT Service, so used the log
files instead.
To debug I just clicked on the NT Service exe in the task manager and
clicked on debug option and it says "Access is denied". Is that how a
debugger is attached?
In Visual Studio 2005 you would use the Tools\Attach to Process menu item
and select your service executable from the process list. Make sure that
you check the box that allows you to view processes from all users. In
addition, unless your service is running under your account credentials, you
must be using an administrative account or one with the appropriate
privileges in order to debug the process.
Lastly, I looked at the code snippet that you have posted as well as your
general comments here and would like to suggest the following:
1. Rethink and rewrite your service. Based upon your statements here, your
architecture sounds flawed.
2. Use the ATL service classes to create your base service template code.
This allows you to concentrate on the functionality of your service rather
than the boilerplate code.
3. Make sure that you concentrate on resource allocation, usage and cleanup.
A service is intended to run *forever*. A resource leak will slowly starve
your system.
4. Do *not* use the TerminateThread.
5. Pick up a good book or two and *read* them. I suggest the following:
1. Developing Server Side Applications for Windows 2000
http://www.amazon.com/o/ASIN/0735607532
2. Programming Applications for Microsoft Windows
http://www.amazon.com/Programming-Applications-Microsoft-Windows-General/dp/1572319968/sr=1-8/qid=1158073793/ref=sr_1_8/102-1222395-3979355?ie=UTF8&s=books
I don't mean to make it sound as if I am denigrating your skill as a
developer, but just be aware that service application development requires
much greater knowledge and care than does "normal" application development
for reasons described in the Richter books.
-Pete
.
- Follow-Ups:
- Re: NT Service Problem
- From: Susanna
- Re: NT Service Problem
- References:
- Re: NT Service Problem
- From: Joseph M . Newcomer
- Re: NT Service Problem
- From: Susanna
- Re: NT Service Problem
- From: David
- Re: NT Service Problem
- From: Joseph M . Newcomer
- Re: NT Service Problem
- From: Susanna
- Re: NT Service Problem
- Prev by Date: Re: Create Hidden window for drawing?
- Next by Date: Re: could i customize the dialog that popups up when calling SHBrowserForFolder
- Previous by thread: Re: NT Service Problem
- Next by thread: Re: NT Service Problem
- Index(es):
Relevant Pages
|