Ahoy, Folks!
I've been looking all over for this, but I just can't seem to shake any
documentation out of the MSDN or from Google. I've reviewed every .NET
article on developing Windows Services in the MSDN I've located.
I'm developing a Windows Service application. This service reads its
configuration data from the system registry (HKLM) where it was deposited by
another "manager" application. No problems there.
The service uses a worker thread to do its work. The thread is created in
the OnStart() and signaled/joined/disposed in the OnStop(). Again, no
problems.
Everything works beautifully when:
1. The system administrator has set up everything properly, and
2. the foreign network resources are all reachable.
But of course, we as developers simply can't rely on:
1. The system administrator having set up everything properly, or
2. the foreign network resources being reachable.
Really, what we need is for the service application to have some way of
dying on its own. If a network resource goes down, we need the service to
stop. But more to the point, we need the SCM to know it has stopped on its
own accord. SCM needs to know that the service has "failed"... and hasn't
just been shut down by someone.
Calling "return" or throwing an exception in the "OnStart()" method isn't
even helpful for services still in the start-up process.. The SCM goes
merrily on and the process keeps running in the Task Manager--though it's
not actually doing anything since the worker thread was never created and
started.
Using a ServiceControll er instance doesn't do it, either. That appears to
the SCM as a normal shutdown--not a service failure. So none of the
recovery actions or restarts happen. (Also, there is MSDNful documentation
warning about the perils of a ServiceBase descendant using a
ServiceControll er to make things happen with itself.)
I've read articles where people were messing about with PInvoking calls to
the native code just to set the "Stopped" status flag in the SCM. But that
doesn't shut down the process the service is running within.
I'd really like to know the Intended Way of:
1. Shutting down a service from within the service, where
2. The SCM is appropriatedly notified that the service has "Stopped",
and
3. The process disappears from the Task Manager.
Solutions involving ServiceControll ers don't seem to be appropriate, if only
because 2 is not satisfied. (That the Framework documentation specifically
contraindicates doing that carries a good deal of weight, incidentally.)
I'd appreciate any recommendations , pointers to documentation, or even
well-reasoned conjecture. :-) Oh! And I'm perfectly happy to entertain
that I've missed the point.
Most cordially,
Ross Bennett
Solution Developer <-- This does not mean I will develop your
photographs. That would be "Developer Solution"
Optical Image Technology, Inc. 0 3393 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: hokiegal99 |
last post by:
How would I determine if a filename is greater than a certain number
of characters and then truncate it to that number? For example a file
named XXXXXXXXX.txt would become XXXXXX
fname = files
if fname > 6
print fname
Thanks!!!
|
by: zhi |
last post by:
Really confused, when I use keyword style argument as following:
>>> input(prompt="hello")
Traceback (most recent call last):
File "<pyshell#52>", line 1, in -toplevel-
input(prompt="hello")
TypeError: input() takes no keyword arguments
While the library reference says the function is: input( )
|
by: Vilmar |
last post by:
Hi,
Can Request.ServerVariables("REMOTE_ADDR") fail and catch the address of my
default gateway in my local network??
What should I do?
Sometimes brings 192.168.0.1(the address of my default gateway) instead the
remode IP address: 200.200.15.2, 64.100.2.1, etc....
Thanks,
--
|
by: Keith |
last post by:
I'm in the same boat as the fellow who posted this message back in
August:
Title : Windows Service, How does one make a service "fail" properly?
Author : Ross Bennett
Group : microsoft.public.dotnet.languages.csharp
URL :...
|
by: Gustavo L. Fabro |
last post by:
Greetings!
I'm testing VS 2005 Beta 2, and I've compiled a program that
runs just fine on my computer (where VS is installed).
I've tried to run this same program on another computer
(after having installed MS .NET Framework 2.0 Beta 2 on it,
from
http://www.microsoft.com/downloads/details.aspx?FamilyId=7ABD8C8F-287E-4C7E-9A4A-A4ECFF40FC8E&displaylang=en),
but got the following message:
| |
by: mrwoopey |
last post by:
I have a asp.net application that uses the crystal report viewer
control.
It displays all of my reports but all of a sudden it started giving me
the following error on ONLY two reports:
"Fail to render the page"
I can view the reports with within Crystal Reports.
The same issue was posted here with no solution:
|
by: Guilherme Silva |
last post by:
Hi All,
I found another problem with .NET about "fail to start monitoring".
This one is different from any other because it only show this error
without "Access Denied".
Even the Excpetion number is not found on MSDN Online or any site on
internet.
The Stacktrace:
|
by: Robbie Hatley |
last post by:
Say I have an ifstream object, like so:
#include <iostream>
#include <fstream>
int main(int, char* Sam)
{
std::ifstream Bob;
Bob.open(Sam);
std::string buffer;
while (42)
|
by: simbasaurus |
last post by:
Hello!
I am trying to make sure that I clean up and free all the resources that I allocate in my code.
In the following code, I am assuming that if new throws bad_alloc, than the value of array1 or array2 is unmodified,
that is, they remain NULL.
In this case, if allocation of array1 succeeds, and allocation of array2 fails, then array1 will be deallocated.
What if new does modify the value of the int* array2 even if second allocation...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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,...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |