The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly." on RouteTable.Routes.MapHubs();

polonskyg picture polonskyg · Jul 8, 2013 · Viewed 19.2k times · Source

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. enter image description here

enter image description here

enter image description here

Answer

Drew Marsh picture Drew Marsh · Jul 10, 2013

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