Search code examples
asp.net-coretcpwebsocketgoogle-cloud-platformgoogle-compute-engine

Google Compute Engine websocket


I have a Google Compute Engine Instance and have an ASP.NET Core application deployed to it. Within that application, I run

WebSocketServer server = new WebSocketServer("ws://0.0.0.0:2001");

To start a websocket server on port 2001. However, when I try and start a websocket connection to this port (m.y.i.p:2001), it times out. I don't understand why since the VM is tagged with the same network tag for ingress and egress that I created allowing access to all ports. If not the firewall, where else could I investigate?


Solution

  • For anyone else that seems to encounter a similar issue with opening a port on a VM running Windows Server (I was using the 2016 edition), I fixed it by remote desktoping into the machine and disabling its firewall. I had to do this even though I had made Compute Engine firewall exceptions. If anyone wants to clarify, I am assuming it's better to handle all firewall related things in GCP rather than having the internal firewall of the VM itself as well since there is likely to be conflict?