I'm working with SignalR 1.1.2 version and Windsor Castle in an AspNet MVC 4 application. My problem is that this error message is showing up since I moved to the newer SignalR version.
"The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly."
in the line
RouteTable.Routes.MapHubs();
This is the RegisterHubs class
public static class RegisterHubs
{
public static void Start()
{
var signalrDependencyContainer = new WindsorContainer().Install(new HubsInstaller());
var signalrDependency = new SignalrDependencyResolver(signalrDependencyContainer.Kernel);
GlobalHost.DependencyResolver = signalrDependency;
RouteTable.Routes.MapHubs();
}
}
I already tried a few things I've found in internet like:
lodctr /R
cd C:\Windows\Inf\.NETFramework
lodctr corperfmonsymbols.ini
But I'm still getting the same error message. Any ideas?
I'm using dotnet framework 4.5.
This is the stacktrace
at System.Diagnostics.PerformanceCounter.InitializeImpl()
Thanks!
UPDATE I'm adding the screenshots requested by Drew.
So based on the information you've provided it is clear that these are first chance exceptions being thrown when SignalR is attempting to create the performance counters but doesn't have the rights to do so with the identity that the process is running under. You can safely ignore these exceptions, but you obviously won't get performance counter data.
If you want to create the performance counters you need to make sure the identity of your application belongs to the Performance Counter Users group when it's running. Either that or you need to use the utility application provided in the Microsoft ASP.NET SignalR Utilities NuGet package that allows you to create the counters out of band. Just install the package and run the command:
signalr ipc
Drew Marsh's response, solved the problem for me, too. Here are additional details describing how to go about running the signalr
command:
Use the package manager to install SignalR Utils:
From the command line, type:
PM> Install-Package Microsoft.AspNet.SignalR.Utils
Running the IDE as an Administrator, run:
PM> signalr ipc
Administrator permissions are needed to do run the performance counters installation command (signalr ipc
) - running without doing so results in this error:
Error: 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, CounterCreationDataCollec tion creationData, Boolean& iniRegistered) at System.Diagnostics.PerformanceCounterLib.RegisterCategory(String category Name, PerformanceCounterCategoryType categoryType, String categoryHelp, Counter CreationDataCollection creationData) at System.Diagnostics.PerformanceCounterCategory.Create(String categoryName, String categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationDataCollection counterData) at Microsoft.AspNet.SignalR.Utils.PerformanceCounterInstaller.InstallCounters()
at Microsoft.AspNet.SignalR.Utils.InstallPerformanceCountersCommand.Execute( String[] args) at Microsoft.AspNet.SignalR.Utils.Program.Main(String[] args) The Zone of the assembly that failed was: MyComputer
Please note that if you follow the (correct) advice mentioned above and invoke 'signalr ipc' to install SignalR's custom counters, your application might inexplicably stop working altogether when running with the debugger. The issue is a bug in how the CLR deals with CultureInfo upon initialization. The problem exists at least in SignalR 2.2.0. The full explanation, and a couple of workarounds are discussed here: https://github.com/SignalR/SignalR/issues/3414
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With