有一个项目需要运行在本地 http 服务器的 8080 端口上,之前还好的,今天突然就提示 以一种访问权限不允许的方式做了一个访问套接字的尝试
在管理员模式下运行 netstat -ano | findstr 8080 没有任何输出

上网搜索发现这可能是一个规则问题

https://stackoverflow.com/questions/54671199/kestrel-unable-to-start

尝试执行 netsh interface ipv4 show excludedportrange protocol=tcp,发现 8080 端口不知道为什么被排除了,使用以下指令成功修复:

net stop winnat
netsh interface ipv4 show excludedportrange protocol=tcp
net start winnat
netsh interface ipv4 show excludedportrange protocol=tcp

参考