Fixed Microsoft HTTPAPI/2.0 use Port 80
Issue
After adding the IIS role in the server management of Windows Server 2012 R2, I found that port 80 was used. I stopped IIS, but port 80 was still in use. Run the curl command as follows:
$ curl -I http://127.0.0.1/
HTTP/1.1 404 Not Found
Content-Length: 315
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Sat, 18 Sep 2021 07:24:04 GMT
Connection: close
It was a Microsoft-HTTPAPI/2.0 server. Since I need to use port 80 in apache or nginx, it causes a port conflict error if start nginx: nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions).
After running netstat
, port 80 is used by the process with PID 4.
netstat
said PID 4 was listening at port 80.
C:\Users\Administrator>netstat -ano | findstr 0.0:80
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4
But failed to stop using taskkill
.
C:\Users\Administrator>taskkill /PID 4
ERROR: The process with PID 4 could not be terminated.
Reason: Access is denied.
Solution
Try these following 2 methods.
1. Stop Web Deployment Service Agent
- Open your Control Panel (Start > Control Panel)
- Change the view setting from Category to Small or Large Icons
- Open Administrative Tools
- Open Services
- Find “Web Deployment Service Agent” in the list
- Right click and choose Properties
- Click Stop
- Change it’s Start Up value to “Manual”
- Hit Apply/OK to save the changes
2. Stop BranchCache Service
- Open your Control Panel (Start > Control Panel)
- Change the view setting from Category to Small or Large Icons
- Open Administrative Tools
- Open Services
- Find “BranchCache” in the list
- Right click and choose Properties
- Click Stop
- Change it’s Start Up value to “Manual”
- Hit Apply/OK to save the changes