473,399 Members | 3,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 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 5250
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?...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.