DEV Community

Discussion on: Troubleshooting WSL + localhost:3000 'connection refused' issue

Collapse
 
acornwall profile image
Alexandria Cornwall

Just a quick heads-up: Disabling iphlpsvc can break TCP forwarding from WSL 2. You might use this feature, for example, if you're trying to debug locally from your phone: github.com/microsoft/WSL/issues/4150

I don't really have a solution other than disabling iphlpsvc, starting up node / yarn, then re-enabling iphlpsvc (or just choosing a different port to start on).

Collapse
 
wetterkrank profile image
Alex Antsiferov • Edited

@acornwall Thanks for mentioning this! Indeed, IP Helper service may be needed at some point, so it's definitely not the bulletproof solution :)

Collapse
 
maxim_mazurok profile image
Maxim Mazurok

This command causes the port to get hogged by IP Helper:

iex "netsh interface portproxy add v4tov4 listenport=$port listenaddress=$addr connectport=$port connectaddress=$remoteport";
Enter fullscreen mode Exit fullscreen mode

And this command can un-hog it:

$addr='0.0.0.0';
$port=3000;
iex "netsh interface portproxy delete v4tov4 listenport=$port listenaddress=$addr";
Enter fullscreen mode Exit fullscreen mode

But you do loose port forwarding from WSL to Windows in this case.

Also, in my case I was able to create server on the same port, and Chrome could open site ok, but Chrome controlled by Cypress coudln't open it, was timing out. Which is weird.