Cannot bind to some ports due to permission denied Cannot bind to some ports due to permission denied windows windows

Cannot bind to some ports due to permission denied


The reason is that Hyper-V takes over these ports, to prevent it from happening do the following:

  1. dism.exe /Online /Disable-Feature:Microsoft-Hyper-V (will have to restart)
  2. netsh int ipv4 add excludedportrange protocol=tcp startport=<your port> numberofports=1
  3. dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

The original solution is here.

If after that you still can't bind to the port do the following:

  • netsh http add iplisten 0.0.0.0 for IPv4
  • netsh http add iplisten :: for IPv6

More information is here.


A faulty Windows upgrade is the reason for the problems with reserved tcp ports.See https://github.com/docker/for-win/issues/3171#issuecomment-554587817

With this the problem should be fixed:netsh int ipv4 set dynamic tcp start=49152 num=16384

That would explain why a clean install fixes these type of problems.


If you face this issue on Win10 2004 that's because of of an issue in this update do the following

netsh int ipv[46] set dynamic tcp start=49152 num=16384

reg add HKLM\SYSTEM\CurrentControlSet\Services\hns\State /v EnableExcludedPortRange /d 0 /f

I face this on opening Jetbrains IDEs and and many other program that use sockets