title: Self-Hosted SignalR service won't work (start)
body: <p>I have SignalR server as Class Library Project and i referenced it in Console application (to simulate Windows service)</p>
  
  <p>Here is code for SignalR</p>
  
  <pre><code>    public void Start()
      {
          try
          {
              string url = @"http://*:8081";
              using (WebApp.Start&lt;Startup&gt;(url))
              {
                  Logger.Info(string.Format("Server running at {0}", url));
              }
          }
          catch (Exception ex)
          {
              Logger.Exception(ex, "Signalr start");
          }
  
          Run = true;
  
          Logger.Info("Starting Worker");
          workerThread = new Thread(() =&gt;
          {
              Worker();
          });
  
          workerThread.Start();
      }
  </code></pre>
  
  <p>And here is Startup class</p>
  
  <pre><code>    public class Startup
      {
          Microsoft.AspNet.SignalR.HubConfiguration hubconfiguration = null;
  
          public void Configuration(IAppBuilder app)
          {
              app.UseCors(CorsOptions.AllowAll);
              hubconfiguration = new HubConfiguration();
              hubconfiguration.EnableDetailedErrors = true;
              app.MapSignalR(hubconfiguration);
          }
      }
  </code></pre>
  
  <p>So, it is in one thread, and worker is in another. That seems fine since i did it in other project where it works. Worker thread isn't problem, it's just empty loop, not related to server in any way.</p>
  
  <p>Problem is that server seems to "stop" - when i look with Netstat, nobody is listening on port 8081. There is no exception, it just silently fails.</p>
  
  <p>I referenced Owin.Cors (and Owin.Host.HttpListener) in console project that actually runs this server but as I said, server just stops.</p>
  
  <p>When I try to connect, client says "connection actively refused" and Putty (telnet) also says "can't connect".</p>
  
  <p>Where is the problem? In a nutshell, i have Class Library with SignalR server that is referenced in Console project that runs it but server just wont work.</p>
  
  <p>[edit]</p>
  
  <p>And there is code of Console app that starts service</p>
  
  <pre><code>    static void Main(string[] args)
      {
          ServiceEngine Engine = new ServiceEngine();
          Engine.Start();
          Console.ReadKey();
          Engine.Stop();
      }
  </code></pre>
  
  <p>P.S. Sorry for my bad English.</p>