WSL2 now supports connecting Localhost from Windows 10 applications
Windows 10 Insider build 18945 has just been released by Microsoft with many noticeable improvements, including Windows Subsystem for Linux version 2 (WSL2) that has been integrated with support for seamless connectivity. Directly, Windows 10 applications with WSL2 applications via localhost.
- Live Tiles will really go into oblivion if the Windows 10 20H1 Start Menu looks great like this
Localhost has now been added back to WSL2
When WSL2 was released with the first version, the tool no longer supported the ability to connect to Linux WSL2 servers from Windows 10 applications using localhost addresses. Therefore, in case you want to connect to the WSL2 application from your Windows applications, you will have to find the IP address assigned to the running Linux distribution and connect to it as an alternative.
As for the version of Windows 10 Insider build 18945, the localhost feature has now been added back to WSL2, and you can connect directly to Docker, NPM or other services running locally on the system through Localhost. This task can be performed using the command nc as shown in the example below.
- Appeared to design Microsoft's new Action Center, the corners are more elegant and modern
Connect via Localhost
With the 're-export' of the localhost feature, users can now fully enjoy the benefits from the increase in performance of WSL2, while still easily accessible to any Linux server. Which they are running.
Link servers to 0.0.0.0 so that localhost works
Some users said they had trouble activating the localhost feature in WSL2 because their server is bound to 127.0.0.1.
The engineer responsible for WSL program manager Craig Loewen stated in a post of the WSL2 error message on the blog that in order for localhost to work, the server needs to be able to access all IP addresses, and therefore limited to 0.0.0.0. Originally written by Craig Loewen as follows:
"Can you check which IP address your php object is bound to? I suspect that it only accepts connections from localhost (127.0.0.1), while also requiring acceptability. The connections come from all IP addresses (for example, link it to 0.0.0.0) so you will need to run the command: php -S 0.0.0.0:8000
'.
For example, users have reported that they cannot let PHP work on localhost with the php -S localhost: 8000
command. This may be because the HOSTS file maps localhost to a specific loopback 127.0.0.1 address and therefore this feature will not work.
- Microsoft releases a new Windows 10 update, Microsoft Edge will be hidden if you install Edge Chromium
Distribution server file WSL2 (WSL2 File Hosts File)
When users bind PHP with 0.0.0.0, use the php -S 0.0.0.0:8000
command, the localhost connection will most likely work properly.
You should read it
- How to Run Linux GUI Applications with WSL2 on Windows
- What is localhost?
- How are Linux kernel updates distributed on Windows Update?
- How to update from WSL to WSL 2 in Windows 10
- What is localhost? What is differenthost compared to 127.0.0.1?
- How to install Windows Subsystem for Linux 2 on Windows 10
- Instructions for installing WordPress on localhost - Part 2
- Summary of Microsoft Build 2019: Windows Terminal, Microsoft Edge ... is there anything else worth noting?
May be interested
- Will Windows RT support Outlook?one of the biggest complaints about windows rt is that it does not support the popular microsoft outlook email application. however, it seems that this drawback is about to be overcome.
- What is special about connecting Windows 10 with Microsoft's iPhone?the us patent office (uspto) has published a microsoft patent application, showing the company is designing an iphone-specific dock, making it easier to connect windows 10 and iphone devices. .
- Microsoft allows users to install Windows Store applications on up to 2000 devicesif you have multiple windows devices linked to your microsoft account, you'll probably be happy to know that microsoft is raising the device load limit of more than 20 times the current application.
- Instructions allow applications to communicate with each other via Windows Firewallwindows firewall acts as a barrier to prevent your computer from connecting to the rest of the internet. the firewall retains unwanted network traffic and allows applications on your computer to communicate with the outside world. but each fence needs a gate, and that's where exceptions come in.
- How to turn off Wi-Fi when connecting to Ethernet in Windows 10the use of wi-fi on mobile devices and computers is extremely convenient, but on the flip side is very battery consuming. therefore, whenever you can use ethernet (wired network), you should make the most of it. however, the problem here is that windows does not automatically disconnect from wi-fi every time you plug in an ethernet network. so in this article, tipsmake.com will guide you to do that.
- 7 utility applications should install for Windows7 useful and compact applications suitable for windows installation.
- Why doesn't Windows 11 support my CPU?besides tpm 2.0, windows 11 also requires some other things about the cpu. specifically, windows 11 requires your computer to have an intel 8th generation cpu or higher or an amd ryzen 2000 or higher. microsoft did not explain the reason, so many users were confused.
- The software supports Bluetooth connection with the computerbluetooth is very handy but does not always work well even if you have bluetooth enabled on your computer. so if one day you have tried all the ways but still can not connect bluetooth to the computer, how to do? don't worry, the software that supports bluetooth connectivity with the computer below will help you quickly solve this problem. in addition to the ability to turn on bluetooth, they also optimize the ability to capture waves and compatibility of bluetooth devices.
- Fix PS5 not connect to WiFiyour playstation 5 is not connecting to the wifi network, and you are not sure if it is a hardware problem on the device or caused by software settings?
- How to fix 'Try Connecting Your Device' Bluetooth pairing error in Windows 10/11some users said they see 'try connecting your device again' or 'try connecting again' error messages in windows when they try to pair bluetooth devices.