Table of contents

Fixed Microsoft HTTPAPI/2.0 use Port 80

Windows Sep 20, 2021 Viewed 1.3K Comments 0

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

  1. Open your Control Panel (Start > Control Panel)
  2. Change the view setting from Category to Small or Large Icons
  3. Open Administrative Tools
  4. Open Services
  5. Find “Web Deployment Service Agent” in the list
  6. Right click and choose Properties
  7. Click Stop
  8. Change it’s Start Up value to “Manual”
  9. Hit Apply/OK to save the changes

2. Stop BranchCache Service

  1. Open your Control Panel (Start > Control Panel)
  2. Change the view setting from Category to Small or Large Icons
  3. Open Administrative Tools
  4. Open Services
  5. Find “BranchCache” in the list
  6. Right click and choose Properties
  7. Click Stop
  8. Change it’s Start Up value to “Manual”
  9. Hit Apply/OK to save the changes
Updated Sep 20, 2021