473,788 Members | 2,898 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 3461
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
18212
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
25211
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
4929
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
3701
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
3056
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
2073
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
9498
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,...
0
10364
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
10172
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...
1
10110
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
9967
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
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4069
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
3
2894
bsmnconsultancy
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...

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.