Many excludedportranges how to delete - hyper-v is disabled
I found an answer at this GitHub comment: you might try
net stop winnat
to free the port. This worked for you in Windows 10 2004, and for me in Windows 10 20H2.
(In earlier version of Windows, I was successful with one of the following, compare How can I know what is preventing my socket to bind to localhost:50060-50959).
net stop LanmanWorkstation
net stop WlanSvc
net stop WwanSvc
While that may disconnect your network, don't despair. Because, if one of the above works for you, you may try the following once to fix this permanently:
netsh int ipv4 add excludedportrange protocol=tcp startport=50323 numberofports=1
(adapt the startport
and the numberofports
to your needs - also, consider ipv6
if needed).
This should survive a net start
of the corresponding service as well as a reboot, as you can check using
netsh interface ipv4 show excludedportrange protocol=tcp
If this outputs
Protocol tcp Port Exclusion Ranges
Start Port End Port
---------- --------
[...]
50145 50244
50323 50323 *
50324 50423
[...]
* - Administered port exclusions.
you should be good for a while.