[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

System.Diagnostics.PerformanceCounterCategory.Create

Pat Piccolo

7/10/2002 10:53:00 PM

In the course of adding a few performance counters to a
Windows 2000 Service written using VBNet I came across the
following problem:

If you create your performance category when your service
starts by using
System.Diagnostics.PerformanceCounterCategory.Create and
use the same name as the service itself
(ServiceProcess.ServiceName) when you run your service all
is fine. However, when you stop your service and delete
your performance category by using
System.Diagnostics.PerformanceCounterCategory.Delete it
actually deletes the service's registration as a service.
You must use the INSTALLUTIL's /U option to uninstall and
then re-install your service.

A little poking around reveals that when the service is
installed using INSTALLUTIL, it creates a key within
HKLM\System\CurrentControlSet\Services with the name of
your service. When you create a performance category,
guess where it goes... same place.

So when you delete your category, if its the same name as
your service, the service gets blown away.

Is there any way around this without having your
performance category named something different than the
service itself?