The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly." on RouteTable.Routes.MapHubs();
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:
- In VS: Tools -> Library Package Manager -> Package Manager Console
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