473,789 Members | 3,186 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# service on stop not triggered

Hello,
I've written a (quite complicated) windows service using C# ,
starting from a wizzard generated project.Added custom installers,
installs and run just fine, does all the work it's supposed to do.

I do not change the CanStop propery anywhere in the code.

But the OnStop protected overriden method is never triggered, and
thus, my cleanup code is never executed.

Searching the Internet high and low, I could not find a similar
problem.Everyon e seems to be getting their onstop just fine.
Today, I've put together a simple service, straight out of the
wizzard and with the bare/minimum installers added.Again, the OnStop
doesn't trigger.

Any ideas?

Thanks,
Jabba
Nov 15 '05 #1
2 4561
Sorry I can't offer any help, but I've had the same problem. the failure to
trigger the OnStop event and the inablity to easily debug the service
eventually led me to simply write a standard app instead. googling revealed
nothing of interest when I was still trying to figure it out. Although I
don't require it anymore, I'm still interrested in finding a solution to
this.

Chris LaJoie
Nov 15 '05 #2
Are you perhaps choking it out with too many cycles and not allowing
that thread to run? Are you using a very tight loop? Something like
for(;;){ ... }? are you erroring out? When a service throws an
exception it simply leaves the scope. No warning. No GUI. No nothing.
It just bubbles the error up to the main function or the first error
trap it finds. Are you using a premature return; statement?

mc*****@iname.c om (Jabba) wrote in message news:<58******* *************** ****@posting.go ogle.com>...
Hello,
I've written a (quite complicated) windows service using C# ,
starting from a wizzard generated project.Added custom installers,
installs and run just fine, does all the work it's supposed to do.

I do not change the CanStop propery anywhere in the code.

But the OnStop protected overriden method is never triggered, and
thus, my cleanup code is never executed.

Searching the Internet high and low, I could not find a similar
problem.Everyon e seems to be getting their onstop just fine.
Today, I've put together a simple service, straight out of the
wizzard and with the bare/minimum installers added.Again, the OnStop
doesn't trigger.

Any ideas?

Thanks,
Jabba

Nov 15 '05 #3

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

Similar topics

6
25202
by: Dmitri Shvetsov | last post by:
Hi All, Did somebody see the situation when the VS refuses to debug the Web Service at all? I can't catch why, the initially created Web Service can be debugged very easy but after some changes in a source code, maybe the source code becomes bigger that some hidden threshold, the debugger can't enter into this code anymore. I can use this web service, all methods but can't see in debugger what's going on. I have already catched this...
3
7841
by: Craig Thompson | last post by:
I've attempted to write a windows service that creates one FileSystemWatcher for each entry in a XML config file. Everything start perfrectly and runs as I expect for about 5 minutes and then after that the FileSystemWatchers seem to stop monitoring... My theory is that for some reason the Garbage Collector is trashing my FileSystemWatchers. Another clue to my situation is that I just took my service and made it into a windows form...
5
12950
by: Dhilip Kumar | last post by:
Hi All, I'm writing a Windows Service app using C#. I need to read some configuration settings before the service starts up. These settings will be used by the service in its operation. Question is, which is the best way to store & retrieve the settings? I'm thinking of storing it in the registry in HKLM\Software\ServiceName and access it using the Registry class in the "public ServiceName()" method. I'm instructing the service...
5
5092
by: Dhilip Kumar | last post by:
Hi all, I have developed a windows service using the windows service project template in VS.NET. I have used three controls in the service, a timer, performance counter and a message queue control. The service will "sleep" for 'n' seconds using the timer control and whenever the timer_elapsed event occurs, I use the performance counter object to determine availability of few resources. Based on the availability of resources, I use the...
3
2198
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My issue is simply getting timers to work. I have a DatabaseManager.DataManagerFacade which contains a timer. Every 6 seconds it updates stock data using an online webservice. I wrote have 2 possible startup projects to make the service work. One...
23
7595
by: Adam Clauss | last post by:
I have a C# Windows Service running as the NetworkService account because it needs to access a network share. As part of the service's initialization, I want the service to terminate, if an unrecoverable error occurs. When that case occurs, I create a ServiceController object and call the Stop() method. However - I get an exception thrown saying access denied. If I switch to using the LocalService account it works fine, but I lose...
2
1239
by: Larry | last post by:
Hello I see that Windows Services are suppose to be able to run in their own background process. I can create simple Services based on the MSDN walkthrough, and get the OnStart/OnStop methods to work fine. But these are only triggered if the user manually goes into Component Services Manager and Starts/Stops the process - i.e. they don't continually run in the background. (Clicking either process puts the server on hold until that method...
3
2608
by: zxo102 | last post by:
Hi there, I have a python application (many python scripts) and I start the application like this python myServer.py start in window. It is running in dos window. Now I would like to put it in background as NT service. I got a example code: SmallestService.py from chapter 18 of the book "Python Programming On Win32" by Mark Hammond etc. The code is as follows and runs well as an NT service.
4
3182
by: kkt49 | last post by:
# vim: et sw=4 ts=8 sts from wxPython.wx import * import sys, os, time import pywintypes import win32serviceutil import win32service import win32event import win32process
0
9665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10139
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3697
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.