title: Simplest possible sample to connect selfhosted signalR-server and client?
body: <p>I'm trying to connect a client to a self-hosted SignalR-server.</p>
  
  <p>My server looks like this:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          string url = "http://localhost:8081/";
          var server = new Server(url);
  
          server.MapConnection&lt;MyConnection&gt;("/echo");
  
          server.Start();
  
          Console.WriteLine("Server running on {0}", url);
  
          Console.ReadKey();
      }
  
      public class MyConnection : PersistentConnection
      {
      }
  </code></pre>
  
  <p>It was the simplest I could came up with. And the client looks like this:</p>
  
  <pre><code>    static void Main(string[] args)
      {
          SignalR.Client.Connection conn = new SignalR.Client.Connection("http://localhost:8081/echo");
          Task start = conn.Start();
          start.Wait();
  
          if (start.Status == TaskStatus.RanToCompletion)
          {
              Console.WriteLine("Connected");
          }
  
          Console.ReadKey();
      }
  </code></pre>
  
  <p>I can't get the code above to work. The server start, but when I run the client code to connect I got an error:</p>
  
  <p>The remote server returned an error: (500) Internal Server Error.</p>
  
  <p>And the server is also giving me an error: Cannot access a disposed object.</p>
  
  <p>Have I forgot something? What am I doing wrong?</p>
  
  <p><strong>Edit:</strong>
  The error I get on the server is the following....</p>
  
  <p>SignalRtest.vshost.exe Error: 0 : A first chance exception of type 'System.AggregateException' occurred in mscorlib.dll
  SignalR exception thrown by Task: System.AggregateException: One or more errors occurred. ---> System.ObjectDisposedException: Cannot access a disposed object.
  Object name: 'System.Net.HttpListenerResponse'.
     at System.Net.HttpListenerResponse.CheckDisposed()
     at System.Net.HttpListenerResponse.get_OutputStream()
     at SignalR.Hosting.Self.Infrastructure.ResponseExtensions.&lt;>c_<em>DisplayClass4.b</em>_1(IAsyncResult ar)
     at System.Threading.Tasks.TaskFactory.FromAsyncCoreLogic(IAsyncResult iar, Action<code>1 endMethod, TaskCompletionSource</code>1 tcs)
     --- End of inner exception stack trace ---
  ---> (Inner Exception #0) System.ObjectDisposedException: Cannot access a disposed object.
  Object name: 'System.Net.HttpListenerResponse'.
     at System.Net.HttpListenerResponse.CheckDisposed()
     at System.Net.HttpListenerResponse.get_OutputStream()
     at SignalR.Hosting.Self.Infrastructure.ResponseExtensions.&lt;>c_<em>DisplayClass4.b</em>_1(IAsyncResult ar)
     at System.Threading.Tasks.TaskFactory.FromAsyncCoreLogic(IAsyncResult iar, Action<code>1 endMethod, TaskCompletionSource</code>1 tcs)&lt;---</p>
  
  <p>'client.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.DebuggerVisualizers\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.DebuggerVisualizers.dll'</p>