473,379 Members | 1,252 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,379 software developers and data experts.

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 3435
1) This is probably an object lifetime issue. If you still have a
ServiceInstaller or ServiceController 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.com> wrote in message
news:11*********************@g44g2000cwa.googlegro ups.com...
1) This is probably an object lifetime issue. If you still have a
ServiceInstaller or ServiceController 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.com> wrote in message
news:uX**************@TK2MSFTNGP14.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 ServiceInstaller 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
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...
3
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',...
149
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? --...
4
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...
16
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...
5
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...
4
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...
35
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....
6
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.