473,799 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DeleteService doesn't actually delete the service until the program is closed.

UJ
I have a program that will upgrade a service automatically. If the service
already exists, it will delete the service and then reinstall it through
code. To delete the service I'm using the DeleteService command which marks
the service as disabled but the service doesn't disappear until the program
shuts down. I've read on the web that it won't disappear until all
connections to the service manager have been closed. I close all my
connections yet it still is there until I close the program.

1. So I have two questions - does anybody know how to delete the service and
have it disappear immediately?
2. If I have a service and am upgrading it, do I need to remove it and
re-install it or can I just replace the executable?

TIA - Jeff.
Oct 18 '05 #1
4 3462
1) This is probably an object lifetime issue. If you still have a
ServiceInstalle r or ServiceControll er that references this service, you
will need to make sure that in has been cleaned up. You can acomplish
this by calling the Dispose() method which will explicitly invoke the
destructor and release associated resources.

2) You must remove and re-install. Services executables and
associated data are stored in a secure location in the registry.
Replacing the file on disk does not affect the service in the registry.

Oct 18 '05 #2
UJ
Thanks for your help. I finally found a spot where I wasn't closing the
service handle. Once I closed that, it works just as advertised.

J.

"Nick Hertl" <nh****@gmail.c om> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
1) This is probably an object lifetime issue. If you still have a
ServiceInstalle r or ServiceControll er that references this service, you
will need to make sure that in has been cleaned up. You can acomplish
this by calling the Dispose() method which will explicitly invoke the
destructor and release associated resources.

2) You must remove and re-install. Services executables and
associated data are stored in a secure location in the registry.
Replacing the file on disk does not affect the service in the registry.

Oct 18 '05 #3
With most services you can just replace the exe, of course it has to be
stopped to do this (whihc you can automate) - but you dont typically have to
remove the service entry.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"UJ" <fr**@nowhere.c om> wrote in message
news:uX******** ******@TK2MSFTN GP14.phx.gbl...
I have a program that will upgrade a service automatically. If the service
already exists, it will delete the service and then reinstall it through
code. To delete the service I'm using the DeleteService command which marks
the service as disabled but the service doesn't disappear until the program
shuts down. I've read on the web that it won't disappear until all
connections to the service manager have been closed. I close all my
connections yet it still is there until I close the program.

1. So I have two questions - does anybody know how to delete the service
and have it disappear immediately?
2. If I have a service and am upgrading it, do I need to remove it and
re-install it or can I just replace the executable?

TIA - Jeff.

Oct 18 '05 #4
This is true if you know where the .NET ServiceInstalle r tucked away
your executable. The trick is that if you replace the exe that you
used to install with InstallUtil, it will have no effect until you use
InstallUtil to uninstall and then reinstall your service. Of course if
you find where on the system it's putting your exe, you could just
replace that exe.

Oct 19 '05 #5

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

Similar topics

6
2594
by: Peter Abel | last post by:
I have an application, which is an instance of a class with a deeply nested object hierarchy. Among others one method will be executed as a thread, which can be stopped. Everything works fine except that when deleting the main instance - after the thread has been stopped - the __del__ method will not be carried out. Tough a simple example works as expected: >>> class A: .... def __init__(self):
3
18213
by: Matthias HALDIMANN | last post by:
My SQL Server 2000 does not use the accent insensitive collation setting (collation containing _AI) in full-text serches: While SELECT * FROM <table> WHERE <column> LIKE '%a%' returns 'Mäuse', SELECT * FROM <table> WHERE CONTAINS(*, 'a') does not. Setting 'default full-text language' to neutral (0) does not help. How can I make full-text searches accent insensitive? Thanks for any ideas!
149
25215
by: Christopher Benson-Manica | last post by:
(Followups set to comp.std.c. Apologies if the crosspost is unwelcome.) strchr() is to strrchr() as strstr() is to strrstr(), but strrstr() isn't part of the standard. Why not? -- Christopher Benson-Manica | I *should* know what I'm talking about - if I ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
4
301
by: UJ | last post by:
I have a program that will upgrade a service automatically. If the service already exists, it will delete the service and then reinstall it through code. To delete the service I'm using the DeleteService command which marks the service as disabled but the service doesn't disappear until the program shuts down. I've read on the web that it won't disappear until all connections to the service manager have been closed. I close all my...
16
4930
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be easily verified: Implement the following in a web service method (just raises a SOAPException with a...
5
2368
by: Bob | last post by:
I've got a .NET Framework V1.1 web service running on a Windows 2003 Server that has 2 web methods that are called from a web application on the same server. One is a fire-and-forget method that executes a long running process that results in a database being updated. The other is a normal syncronous method that returns configuration information to the caller. They both log their errors to the application event log.
4
3702
by: Robert Blackwell | last post by:
A while ago I had some help from here to make a batch file that would dump my db. Everything was working just fine until 2 days ago and I just found out. I checked my backup folder and found that starting on 4/25/2006 the dump files are empty and only shows a few lines of comments or something instead of creating a normal dump as it had been doing just fine for the last few weeks. Quote:
35
3057
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files. In C#, there appears to be no analog. I have to compile all my .cs files into a single .dll. This has serious drawbacks in terms of compilation. With Eclipse, I change a file and only that file is re-compiled. With Visual Studio, I
6
2074
by: SAL | last post by:
Hi, VS2005 post I'm opening a window using the following syntax: Protected Sub lbEstValue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Response.Write("<script>window.open('EstValueHelp.aspx','_help', 'width=400,height=400');</script>") End Sub
0
9689
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
10495
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10269
jinu1996
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...
0
9085
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
7573
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
6811
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
5469
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...
0
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.