You have to find the IP address of the virtual machine powering your Linux distribution with: ip addr | grep eth0 as shown in Accessing network applications with WSL | Microsoft Docs and use this address instead of localhost.
You have to find the IP address of the virtual machine powering your Linux distribution with: ip addr | grep eth0 as shown in Accessing network applications with WSL | Microsoft Docs and use this address instead of localhost.