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