Reputation: 3970
I have a MVC4 website which requires a web socket server which I have implemented using Alchemy in the web role of my Azure cloud service like so:
namespace MvcWebRole1
{
public class WebRole : RoleEntryPoint
{
private static List<UserContext> Users = new List<UserContext>();
public override bool OnStart()
{
Task.Factory.StartNew(OnStartWebSocketServer, TaskCreationOptions.LongRunning);
return base.OnStart();
}
private void OnStartWebSocketServer()
{
var aServer = new WebSocketServer(5004, IPAddress.Any)
{
OnReceive = OnReceive,
OnSend = OnSend,
OnConnect = OnConnect,
OnConnected = OnConnected,
OnDisconnect = OnDisconnect,
TimeOut = new TimeSpan(0, 5, 0)
};
aServer.Start();
}
I am currently still trying to debug locally, and am not able to connect to the server, I get Unexpected response code: 200
in the Chrome debugger.
Is there any way that I can check that the server is even running e.g. displaying the console? Is this even a good approach? I am completely new to Azure and web sockets and am still trying to learn the basics, so please excuse me if I haven't checked some basic settings.
EDIT:
As suggested by Sandrino I have checked the web role end points. I have switched everything to port 5004 in the hopes that it is unused. However I still get Windows Azure Tools: Warning: Remapping private port 5004 to 5005 in role 'MvcWebRole1' to avoid conflict during emulation.
. I also added an exception to my firewall for these ports but still nothing works.
Upvotes: 1
Views: 1630
Reputation: 3970
I figured out what the problem was. The endpoints that I was opening were HTTP whereas web sockets work over TCP. In order to solve the problem there must be:
Upvotes: 1