title: Getting "The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly." while trying to self-host SignalR with Owin
body: <p>I'm trying to develop a Windows Form application that self-hosts SignalR through the use of OWIN.</p>
  
  <p>I have found a couple of examples out there and they all point generally to something similar to the code bellow.</p>
  
  <pre><code>public partial class Form1 : Form
  {
      public Form1()
      {
          InitializeComponent();
  
          string url = "http://127.0.0.1:8080";
          using (WebApplication.Start&lt;MyStartUp&gt;(url))
          {
              Debug.WriteLine(string.Format("Server running on {0}", url));
          }
      }
  
      private void button1_Click(object sender, EventArgs e)
      {
  
      }
  
  }
  
  internal class MyStartUp
  {
      public void Configuration(IAppBuilder app)
      {
          HubConfiguration config = new HubConfiguration {
              EnableCrossDomain = true
          };
  
          app.MapHubs(config);
      }
  }
  </code></pre>
  
  <p>When I run the example, though, I consistently get the error "The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly." on the following line:</p>
  
  <pre><code>app.MapHubs(config);
  </code></pre>
  
  <p>I have found a few articles out there about the general error, which has to do with (obviously) a problem with custom Performance Counters. Nonetheless none of the possible solutions I found seem to be of any help, mainly because, well, it's suppose to be an issue with a custom counter, not a regular .Net framework counter missing.</p>
  
  <p>Has anyone found a similar problem or can shed some light into the matter?</p>
  
  <p>Thank you in advance.</p>