Port 80 被佔用

Microsoft Windows 相關知識
回覆文章
dtchang
Site Admin
文章: 84
註冊時間: 2017-01-22, 16:54

Port 80 被佔用

文章 dtchang » 2018-01-22, 15:04

case 1.
netstat -ano | findstr :yourPortNumber
netstat -ano | findstr :80
若找到的 process id 不是 system(4) 則可直接kill掉
taskkill /PID typeyourPIDhere /F
或試
tskill typeyourPIDhere

case 2: 若是 sytem(4),那麼需找到主凶

TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4

使用 regedit
找到 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP
將 start 值設為 4 (即 disable) 然後重開機,
強制使用 http.sys 停止.
(start 原設定值為 3)
(此法不佳)

--------------
常見被 W3SVC (IIS) 搶用,這可修改 IIS 連接埠即可

case 3: 若是 sytem(4), 被 http.sys 佔用
Known Windows Services That Listen on Port 80:
SQL Server Reporting Services (ReportServer)
Web Deployment Agent Service (MsDepSvc)
BranchCache (PeerDistSvc)
Sync Share Service (SyncShareSvc)
World Wide Web Publishing Service (W3SVC)
Internet Information Server (WAS, IISADMIN)

使用命令停止使用 http.sys 的相關服務
net stop http /y
sc config http start= disabled (停用, 在windows 2016會出錯)

關閉後,即可以啟動 apache 80 服務,然後再安裝和設定 IIS 到別的port

回覆文章