Unable to create performance counter category

1,150 views
Skip to first unread message

KevM

unread,
Oct 14, 2009, 11:46:27 AM10/14/09
to masstransit-discuss
FYI - Recently grabbed latest of MassTransit and now I am seeing these
Errors in my log.

ERROR 10:41:54 Unable to create performance counter category
System.Security.SecurityException: Requested registry access is not
allowed.
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean
writable)
at System.Diagnostics.PerformanceCounterLib.CreateRegistryEntry
(String categoryName, PerformanceCounterCategoryType categoryType,
CounterCreationDataCollection creationData, Boolean& iniRegistered)

at System.Diagnostics.PerformanceCounterLib.RegisterCategory(String
categoryName, PerformanceCounterCategoryType categoryType, String
categoryHelp, CounterCreationDataCollection creationData)
at System.Diagnostics.PerformanceCounterCategory.Create(String
categoryName, String categoryHelp, PerformanceCounterCategoryType
categoryType, CounterCreationDataCollection counterData)
at
MassTransit.Monitoring.ServiceBusPerformanceCounters.InitiatizeCategory
() in c:\projects\masstransit\src\MassTransit\Monitoring
\ServiceBusPerformanceCounters.cs:line 152
The Zone of the assembly that failed was: MyComputer
ERROR 10:41:54 Unable to create performance counter
System.InvalidOperationException: The requested Performance Counter is
not a custom counter, it has to be initialized as ReadOnly.
at System.Diagnostics.PerformanceCounter.Initialize()
at System.Diagnostics.PerformanceCounter..ctor(String categoryName,
String counterName, String instanceName, Boolean readOnly)
at MassTransit.Monitoring.InstancePerformanceCounter..ctor(String
name, String categoryName, String instanceName) in c:\projects
\masstransit\src\MassTransit\Monitoring\InstancePerformanceCounter.cs
:line 26
at
MassTransit.Monitoring.ServiceBusInstancePerformanceCounters.CreateCounter
(RuntimePerformanceCounter counter) in c:\projects\masstransit\src
\MassTransit\Monitoring\ServiceBusInstancePerformanceCounters.cs:line
151

*** Repeats quite a few times ***

Dru Sellers

unread,
Oct 14, 2009, 11:48:27 AM10/14/09
to masstrans...@googlegroups.com
hmmm, maybe it has to be admin to create the counters?

Chris added some performance counters (perfmon) over the weekend.

-d

Kevin Miller

unread,
Oct 14, 2009, 11:53:30 AM10/14/09
to masstrans...@googlegroups.com
Oops forgot to mention this is on Windows 7 without elevated privs.

It is not impacting me just crapping all over the logs :)

Kevin Miller

Dru Sellers

unread,
Oct 14, 2009, 12:41:17 PM10/14/09
to masstrans...@googlegroups.com
what happens when you try with elevated permissions?
-d

Chris Patterson

unread,
Oct 14, 2009, 9:41:16 PM10/14/09
to masstrans...@googlegroups.com
Yeah, you have to be admin at least once to add the categories. 

Once they are there, it works without elevated privileges. And it just craps in the log to let you know that you are missing out on some great features.


Chris Patterson



Dru Sellers

unread,
Oct 14, 2009, 9:49:01 PM10/14/09
to masstrans...@googlegroups.com
we should have the logs say something to this effect. 

Kevin Miller

unread,
Oct 14, 2009, 10:01:37 PM10/14/09
to masstrans...@googlegroups.com
Not sure how many users are going to run their MT apps as administrator. I sure wouldn't if I could help it. You could have a little command line utility that attempts to create all the necessary performance counters. We've done something similar in the past. 

I'd even be happy to take a look at building you a little MT installer which could likely do such things for you. The installer story is not such a good one for MT as people will usually be using it as a library. 

Kevin Miller

Dru Sellers

unread,
Oct 14, 2009, 10:06:56 PM10/14/09
to masstrans...@googlegroups.com
maybe it can be a part of busdriver?
to be clear, it only has to be run once as admin.

-d

Chris Patterson

unread,
Oct 14, 2009, 10:08:27 PM10/14/09
to masstrans...@googlegroups.com
Right, once it has been run, the category is created and its over.

We could probably call the class from busdriver and do an assert to request temporary admin on vista/7.
Chris Patterson



Reply all
Reply to author
Forward
0 new messages