Windows没有程序使用1080端口被占用

最近几天在使用1080端口时,发现提示端口被占用,所以使用了惯用的命令进行查看。

netstat -aon|findstr "1080"

但是实际上并没有什么程序在占用此端口,所以临时的方案改成了使用10800端口先应付着使用。
但是我认为事情并不能这么放着,在我有时间的时候我又分别测试了端口的范围,发现不仅仅时1080不能够使用,其上下端口范围均不能使用。由此我想到了会不会在更新完系统后,Windows也像Linux一样对范围小的端口进行了权限的限制,但使用管理员权限打开依旧如此。
不过确实能够找到问题的范围,由此找到了以下的链接。
端口无法访问
解决hyper-V开启带来的端口问题
根据以上的帖子,确实能够联想到最近安装过docker,在Windows中docker使用的时hyper-V实现的。使用以下命令查看1080端口是否在范围内。

netsh interface ipv4 show excludedportrange protocol=tcp

确定之后,参考这篇帖子Unable to bind ports
可以将hyper-V关闭,输入以下命令

:Disable hyper-v (which will required a couple of restarts)
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

:When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it back
netsh int ipv4 add excludedportrange protocol=tcp startport=1080 numberofports=1

:Re-Enable hyper-V (which will require a couple of restart)
dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All

:when your system is back, you will be able to bind to that port successfully.

在这里我是用不到docker了,所以将docker和hyper-V直接也卸载掉了,没有输入以上命令,仅供参考。

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

微信扫一扫,分享到朋友圈

Windows没有程序使用1080端口被占用
返回顶部

显示

忘记密码?

显示

显示

获取验证码

Close