Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to local server started in WSL2 from Windows #5018

Closed
vinnyvinnyvinny opened this issue Mar 27, 2020 · 7 comments
Closed

Can't connect to local server started in WSL2 from Windows #5018

vinnyvinnyvinny opened this issue Mar 27, 2020 · 7 comments

Comments

@vinnyvinnyvinny
Copy link

  • Your Windows build number: Version 10.0.19041.172

  • What you're doing and what's happening:
    I'm unable to connect to a rails server started in my WSL2 instance of Ubuntu. The server starts as expected and is able to receive requests from ubuntu:

image

image

However when trying to access via windows, I get a ERR_CON_REFUSED error:

image

Issue doesn't seem to apply to port 80, for example, running "sudo nc -l 80" and then making a request from windows browser results in ubuntu receiving the request:

image

This issue also occurs when starting mailcatcher on port 1080, I'm unable to access mailcatcher from a windows browser event though it is accessible from within ubuntu:

Mailcatcher in Links:
image

Trying to connect in Chrome on Windows:
image

This was working up until yesterday evening, however has now stopped working. I also updated my windows install to KB4552455 earlier in the day yesterday, but am unsure whether this is related or not.

@crramirez
Copy link
Contributor

Hello,

This is configured to only Listen in the local interface: tcp://127.0.0.1:3000. Configure it to listen in all interfaces, something like tcp://0.0.0.0:3000

Regards,
Carlos

@vinnyvinnyvinny
Copy link
Author

Hi @crramirez .

Thanks for you reply, I tried this, but unfortunatey I'm getting the same result:

image

@crramirez
Copy link
Contributor

Ok I am out of ideas

@therealkenc
Copy link
Collaborator

Other half is the IP address on the client. Once you are listening on 0.0.0.0 (which looks good in the screencap), use the IP address returned by hostname -I on the WSL side on the client. Likely same as #4851, which is open and actionable (contrast question, answered).

@vinnyvinnyvinny
Copy link
Author

I somehow managed to get it working again. Steps I carried out that resolved the issue:

  1. run the following command in Powershell
    Get-Service LxssManager | Restart-Service
  2. Enabled the following Under "Turn Windows features on and off"
  • Hyper-V
  • Windows Hypervisor Platform
  1. Restart

No idea what of the above caused the issue to go away, but it seems to be working now.

@uiosun
Copy link

uiosun commented Mar 1, 2021

I somehow managed to get it working again. Steps I carried out that resolved the issue:

  1. run the following command in Powershell
    Get-Service LxssManager | Restart-Service
  2. Enabled the following Under "Turn Windows features on and off"
  • Hyper-V
  • Windows Hypervisor Platform
  1. Restart

No idea what of the above caused the issue to go away, but it seems to be working now.

I only run Get-Service LxssManager | Restart-Service, the error is resolve!

Thank you!

@czepesch
Copy link

I somehow managed to get it working again. Steps I carried out that resolved the issue:

  1. run the following command in Powershell
    Get-Service LxssManager | Restart-Service
  2. Enabled the following Under "Turn Windows features on and off"
  • Hyper-V
  • Windows Hypervisor Platform
  1. Restart

No idea what of the above caused the issue to go away, but it seems to be working now.

I only run Get-Service LxssManager | Restart-Service, the error is resolve!

Thank you!

Windows updated yesterday, had similar issue.
In my case it was:

Enabled the following Under "Turn Windows features on and off"
Hyper-V
Windows Hypervisor Platform

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants