472,962 Members | 2,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,962 software developers and data experts.

Windows service won't start/stop correctly on one of my test machines...

I have a windows service that when started creates two threads: one thread
that runs a TcpListener waiting for TcpClients to connect, and another
thread that reads from the resulting sockets. My stop code .Abort()s the
threads and .Stop()s the listener.

One one of my computers, the service runs like, well...a service. It starts
and stops nicely. On a different computer (eventually this service will be
running on 50+ machines) the service starts up fine, but when you stop it it
seems to hang. Services.mmc reports "Stopping". The very first line in my
Stop() method writes to the Event Log, but that line is never getting
executed (no log entry appears).

Most often, it stays in "Stopping" until I kill the process via the task
manager. When I do this, subsequent attempts to Start result in
Services.mmc telling me "The service on Local Computer started and the
stopped. Some services stop automatically if they have no work to do..."

I'd say its something to do with my shutdown, like me trying to abort the
threads and them not cooperating, but like I say it works fine on one PC but
not another.
Aug 23 '05 #1
2 5218
Worse case scenario, you could install vs.net on this computer and
debug the onstop method to see where it's hanging.

Aug 23 '05 #2

Do you do something like a Thread.Join to make sure they are all stopped?

Are you using any try/catch blocks in the shutdown method to see if any
errors are thrown (and write them to a Trace.Listener text file or event
log) ?

0to60 wrote:
I have a windows service that when started creates two threads: one thread
that runs a TcpListener waiting for TcpClients to connect, and another
thread that reads from the resulting sockets. My stop code .Abort()s the
threads and .Stop()s the listener.

One one of my computers, the service runs like, well...a service. It starts
and stops nicely. On a different computer (eventually this service will be
running on 50+ machines) the service starts up fine, but when you stop it it
seems to hang. Services.mmc reports "Stopping". The very first line in my
Stop() method writes to the Event Log, but that line is never getting
executed (no log entry appears).

Most often, it stays in "Stopping" until I kill the process via the task
manager. When I do this, subsequent attempts to Start result in
Services.mmc telling me "The service on Local Computer started and the
stopped. Some services stop automatically if they have no work to do..."

I'd say its something to do with my shutdown, like me trying to abort the
threads and them not cooperating, but like I say it works fine on one PC but
not another.

Aug 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jesper Stocholm | last post by:
I have created a simple service which just copies a fil to a new file with a new name on certain intervals (the service implements a timer). I have no problems installing the service and the...
2
by: Mark | last post by:
I created an extremely simple windows service that only writes to the EventLogs on Stop and Pause. I installed it using the InstallUtil.exe program, the output of which is below. It appears to be...
3
by: mpriem | last post by:
Hi, I am developing my very first Windows Service. I want to query AD every 5 minutes to generate a Report which I will use in a website. I use the following testcode, but the service won't...
2
by: 0to60 | last post by:
I have a windows service that when started creates two threads: one thread that runs a TcpListener waiting for TcpClients to connect, and another thread that reads from the resulting sockets. My...
7
by: shai | last post by:
I am working at .net 1.1, writing in c#. I have windows service with a COM object. Every unexpected time The COM object throw an error that make my service get stuck (do not respond). I can catch...
8
by: Todd Jaspers | last post by:
Hey guys, I've written a fairly simple Windows C# Application using Visual Studio 2005. I have to manually run it, but I would prefer to have it run on it's own, as if it was a Windows NT...
3
by: rkausch | last post by:
Hello, I'm performing some research to determine the feasibility of developing a Windows Service (see http://en.wikipedia.org/wiki/Windows_Service for the specific definition of "service" to which...
1
by: TJ | last post by:
I created a windows service using VS2005. I created/adjusted the install class using the designer controls. I set the user to be 'local system'. I installed the service using the VS2005 cmd...
5
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name?...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.