How to Stop Serviced Component so Uninstall removes it completely

G

Guest

We have several serviced components written in .NET 1.1. Using Visual
Studio, we have an installer project that creates an installer for them.

The components are installed properly into the GAC and show in the Component
Services control panel.

The issue is when we uninstall or want to upgrade the components. What we
have found is if there are live instances pooled and running (which is always
the case as we want them to be ready for calls by a web application), then if
we just uninstall or try an upgrade install, the component is not removed
from the Component Services list. After an upgrade we would then see two
versions registered, the old one and the new one where the old one won't of
course work because the files have been removed. This causes issues with the
calling web application which seems to get confused.

It's also confusing to look at at the least.

However, if we stop the component first by going to the Component services
control panel and right clicking Shutdown on it. Then when we do an
uninstall or an upgrade install, the old version is removed from the
Component Services list and the new one added and everything is fine.

So my question is....is there a way to put a custom action in the Visual
Studio installer so that during it's "before uninstall" function it can
shutdown the component so we don't have to do it manually.

I know how to tell the installer project to do something but I don't know
how you shutdown a component like this programatically.
 
G

Gary Chang[MSFT]

Hi Robert,
......
I know how to tell the installer project to do something but I don't
know how you shutdown a component like this programatically.

If you want to shut down and remove a component service programmatically,
you can use Component Services Administration (COMAdmin) objects to acheive
it, I suggest you manipulate the COMAdmin objects in a vbs file in order
you can call it in a custom action in your installer program.

For details of how to shut down and remove a component service in a vbs
file, please refer to the following MSDN article and related newsgroup
thread, which has a helpful sample on this issue:

Automating COM+ Administration
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/html
/f302eb02-2ef5-42ee-a18f-59f7e60b38df.asp

Update a COM+ DLL in Component Services on Win2K
http://groups-beta.google.com/group/microsoft.public.vb.com/browse_thread/th
read/9cca0e35fa656695/27f2b46be706beaa?lnk=st&q=uninstall+%22component+servi
ces%22+vbscript&rnum=1&hl=en#27f2b46be706beaa


Hope this helps!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Thanks, I was able to get this to work by overriding the OnBeforeUninstall
event in a custom installer in the project and adding the below:

' Instantiate a COMAdminCatalog object.
Dim objCatalog As COMAdminCatalog = CreateObject("COMAdmin.COMAdminCatalog")

objCatalog.ShutdownApplication("Analyzer Control Publisher Application")

Works great.

Thanks.
R-

"Gary Chang[MSFT]" said:
Hi Robert,
......
I know how to tell the installer project to do something but I don't
know how you shutdown a component like this programatically.

If you want to shut down and remove a component service programmatically,
you can use Component Services Administration (COMAdmin) objects to acheive
it, I suggest you manipulate the COMAdmin objects in a vbs file in order
you can call it in a custom action in your installer program.

For details of how to shut down and remove a component service in a vbs
file, please refer to the following MSDN article and related newsgroup
thread, which has a helpful sample on this issue:

Automating COM+ Administration
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/html
/f302eb02-2ef5-42ee-a18f-59f7e60b38df.asp

Update a COM+ DLL in Component Services on Win2K
http://groups-beta.google.com/group/microsoft.public.vb.com/browse_thread/th
read/9cca0e35fa656695/27f2b46be706beaa?lnk=st&q=uninstall+%22component+servi
ces%22+vbscript&rnum=1&hl=en#27f2b46be706beaa


Hope this helps!

Best regards,

Gary Chang
Microsoft Community Support
--------------------
Get Secure! ¡§C www.microsoft.com/security
Register to Access MSDN Managed Newsgroups!
http://support.microsoft.com/default.aspx?scid=/servicedesks/msdn/nospam.asp
&SD=msdn

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top