Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / August 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
0to60 - 23 Aug 2005 22:01 GMT
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.
steve - 23 Aug 2005 23:31 GMT
Worse case scenario, you could install vs.net on this computer and
debug the onstop method to see where it's hanging.
John Bailo - 23 Aug 2005 23:56 GMT
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) ?

> I have a windows service that when started creates two threads: one thread
> that runs a TcpListener waiting for TcpClients to connect, and another
[quoted text clipped - 16 lines]
> threads and them not cooperating, but like I say it works fine on one PC but
> not another.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.