It sounds like you are running WSL2, since as Woodsman mentioned in the comments, network services running under WSL1 appear to be running on the Windows host network itself.
In WSL2, the instance is running in a Hyper-V VM with a virtual NIC that is NAT'd behind the Windows host. However, the Windows host itself should have direct access to services running in the instance through localhost
. WSL appears to do some automatic port-forwarding, but only from the local Windows host to the WSL instance.
In other words, other machines on your local network will not see the WSL network services unless you do some port forwarding (and firewall rules) as per something like this comment in a Github thread on the topic. Again, this should only be necessary if you are trying to access the WSL network apps from elsewhere on your network (your phone, for instance). However, following those steps will also have the side effect of resolving the next issue.
That issue being that localhost
auto-forwarding under WSL seems to break down under (at least) several scenarios. If that's the case, and you aren't able to access your node or Tomcat servers via localhost:port
, then see this answer for suggestions. It's most likely that a quick wsl --shutdown
will resolve (even if you've rebooted). If the problem occurs again, it's likely due to hibernation, or a Windows shutdown/restart with the Fast Startup feature enabled (which also does "partial" hibernation).
You also mention that you aren't able to see Windows network services from WSL, although the examples you give there are VSCode and Eclipse, which are a bit incongruous to me since those are editors rather than network apps/services.
But let's say you were running Maria DB on Windows, for instance, and you wanted to access it from inside WSL2. localhost
will not work in that case, since localhost
is the virtual NIC of the WSL subsystem. For that, see this answer -- Short summary is to try mDNS (mywindowscomputername.local
, replacing the first part with your computer name) or get the Windows's host IP via command. I didn't realize it when I wrote up that answer (I should go back and edit it), but windowscomputername.mshome.net
is also reported to work.