解决 Windows 端口被占用的问题

在启动 Go 服务时,遇到一个报错:

1
2
net.Listen address ":80" failed: listen tcp :80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.
1. net.Listen address ":80" failed

一看就是 80 端口被占用了,有可能是 IIS、Apache或你重未听说过的应用,如 SQL Server Reporting Services,那如何找到占用端口的应用呢?