castle-windsorperformancecounterperformance-monitor

Windsor Performance Counter miss in PerfMon


I would like to add the performance counter of windsor in my Performance Monitor... I have configured Windsor as indicated in the docs :

var diagnostic = LifecycledComponentsReleasePolicy.GetTrackedComponentsDiagnostic(container.Kernel);
var counter = LifecycledComponentsReleasePolicy.GetTrackedComponentsPerformanceCounter(new PerformanceMetricsFactory());
container.Kernel.ReleasePolicy = new LifecycledComponentsReleasePolicy(diagnostic, counter);

Then I run my Web Api application, and I run the performance Monitor. But when I try to add a new counter I do not find the "Castle Windsor" section. enter image description here

What's wrong in what am I doing?

PS.: I am using windsor 4


Solution

  • It is likely Windsor doesn't have permission to create the performance counter category and counter (i.e. write to the registry) and is swallowing the SecurityException in PerformanceMetricsFactory.Initialize.

    Run your application or Visual Studio elevated as administrator, you will only need to do this once.