title: Unable to connect to the remote server using ClientWebSocket
body: <p>I'm trying to connect to a web socket server on localhost:9222 using this C# code:</p>
  
  <pre><code>var ws = new ClientWebSocket();
  var uri = new Uri("ws://localhost:9222/X/Y/Z", UriKind.Absolute);
  await ws.ConnectAsync(uri, CancellationToken.None);
  </code></pre>
  
  <p>On that last line, I'm getting <code>Unable to connect to the remote server</code>, with inner exception <code>The remote server returned an error: (404) Not Found.</code>. </p>
  
  <p>However, I have this JavaScript that connects to the same WebSocket:</p>
  
  <pre><code>var ws = new WebSocket("ws://localhost:9222/X/Y/Z");
  </code></pre>
  
  <p>And it works great in both IE and Chrome. </p>
  
  <p>I'm not using any proxies.</p>
  
  <p>Is there something I've missed to configure in the C# code? </p>
  
  <p>How can I debug this?</p>
  
  <p><strong>Update:</strong></p>
  
  <p>Using WebSocket4Net instead of the .NET 4.5 ClientWebSocket, I'm getting <code>HTTP 1.1 500: Internal Server Error</code>. However, I'm not sure how I can debug this either. </p>