67

I was trying to install Zend Server CE on my computer but when I got to the point were I need to choose the port for my Web Server it says: "Web Server Port: 80 Occupied". So I decided to check what is using Port 80 with CMD by typing: "netstat -o -n -a | findstr 0.0:80":

TCP     0.0.0.0:80     0.0.0.0:0     LISTENING     4

I check for PID:4 in Task Manager's Processes and Services. Seems PID 4 is "System".

So, what I want to know is how can I stop "System" (PID:4) from using Port 80?

INFO: I am using: Windows 7 64bit; Zend Server CE 5.5.0

apokaliptis
  • 1,952
  • 2
  • 15
  • 15
  • Wouldn't hurt to telnet a "GET / HTTP/1.1" to 127.0.0.1 and see what comes up. – LawrenceC Oct 30 '11 at 03:18
  • @ultrasawblade How exactly do I do that? – apokaliptis Oct 30 '11 at 03:28
  • 1
    Run `telnet 127.0.0.1 80` and then past that line in and press enter twice. If you're running Windows 7, you need to install telnet client from "add and remove Windows features" first. – billc.cn Oct 30 '11 at 22:35
  • 1
    World Wide Web Publishing service in Windows 8 64 for me did the trick. –  Jan 10 '13 at 19:17
  • 3
    HTTP service state can help you to identify the running services in case of PID 4. Run `netsh http show servicestate` and look at _registered URLs_ or _Logging information_. – pazadev Jun 13 '16 at 15:44
  • Corollary to HTTP.SYS: an alternative to killing the thing stone dead (as suggested by several answers) would be temporarily taking down whatever caused HTTP.SYS to get loaded. E.g. on my development machine I only need to stop SQL Server Reporting Services and - voila - Apache starts on port 80 as meek as you please. – DarthGizka Aug 17 '20 at 12:06

7 Answers7

90

Ok, after searching the web for a while I found a solution to my problem.

Just follow these steps to diagnose and resolve your issue:

  1. Get pid that is listening port 80: netstat -nao | find ":80"

  2. Open task manager, go to processes tab and check “PID” in Menu/View/Select Columns…, then look for the process using the PID found in last step.

  3. If it is a normal application or IIS, disable it or uninstall. Some programs (such as Skype) have the option to disable its use of port 80.

  4. If it is a System Process—PID 4—you need to disable the HTTP.sys driver which is started on demand by another service, such as Windows Remote Management or Print Spooler on Windows 7 or 2008.

    There is two ways to disable it but the first one is safer:

    1.

    • Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (or set it to manual, some services depended on it).

    • Reboot and use netstat -nao | find ":80" to check if 80 is still used.

    2.

    • Launch RegEdit.

    • Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP

    • Change the value of "start" to 4, which means disabled.

    • Reboot your computer.

My solution was step 4.

apokaliptis
  • 1,952
  • 2
  • 15
  • 15
  • After seeing a ton of answers on SO and SU - this is the only one that worked. I disabled everything else, and http.sys was still screwing around, and I didn't really want to make a registry change because I'd probable forget where it lived, so option 1 really helped me out. No reboot necessary. – AndrewPK Apr 18 '12 at 16:21
  • Without this service I cannot run the printer spooler... However with this service I can not run Apache on port 80!! – Tobia May 16 '13 at 06:27
  • I know `Thank you` is not part of commenting but I've been searching for weeks and from hundreds of results, 4.1 above is the ONLY one that worked. Thanks a million. I'd donate all my rep to you if I could – Onimusha Sep 05 '13 at 08:41
  • 5
    Where is the "Non-Plug and Play Driver" tree in the device manager of Windows Server 2012? – Maria Ines Parnisari Dec 21 '14 at 19:16
  • 5
    The device manager approach isn't available from Windows 8 onwards. – Roddy Aug 28 '15 at 08:27
  • 2
    The registry solution worked on Win8. I miss Linux. – AlikElzin-kilaka Sep 04 '15 at 18:13
  • What's the value of `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP.start` before changing to 4? – AlikElzin-kilaka Nov 02 '15 at 12:08
  • Installing a new Win 8.1, the value is 3 (before changing to 4). – AlikElzin-kilaka Nov 25 '15 at 19:07
  • Your solution worked for me, the problem was SKYPE which was using the port :80 THANKS! – Roger Oliveira Apr 27 '16 at 04:23
  • 10
    Please tweak this a little bit. Disabling the "HTTP" service in Windows disables all of it's dependencies. The specific service using port 80 is "W3SVC" (The World Wide Web Publishing Service), a dependency of "HTTP". This can be verified by running "net stop W3SVC" from an Administrative Command Prompt, and then 'netstat -n -o -a | find ":80"' to verify nothing is listing on port 80 anymore. I recommend disabling the World Wide Web Publishing Service (W3SVC) instead (if you don't want to disable SSDP, the Print Spooler, HomeGroup, and Function Discovery). – chriv May 03 '16 at 19:32
  • this solution is not working for me. – JeetDaloneboy Nov 18 '16 at 10:58
  • 4
    I don't understand this instruction at all ``Go to device manager, select “show hidden devices” from menu/view, go to “Non-Plug and Play Driver”/HTTP, double click it to disable it (or set it to manual, some services depended on it).`` There is no ``Non-Plug and Play Driver”/HTTP`` menu item anywhere. – Martin Erlic Apr 13 '17 at 08:42
  • 1
    Disabling the HTTP.sys driver is not the right way. Instead, you should find out what is making it listen (it doesn’t do anything by itself) and stop that. Please see [my answer here](https://superuser.com/a/726975/219095). – Daniel B Apr 24 '17 at 17:03
  • @AlikElzin-kilaka It's default value is 3 – darylknight May 01 '17 at 20:46
  • 1
    You don't need to disable the HTTP.sys, you can just tell him to not use port 80 by removing (or altering) the correct values in this key `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\UrlAclInfo`, then restart the computer. – Felype Aug 22 '17 at 13:24
  • in powershell you should use `netstat -nao | findstr ":80"` – Dalvik VM Jan 28 '20 at 10:24
  • The last solution broke iis for me. – Dalvik VM Jan 28 '20 at 12:22
33

I just had this issue after installing Windows 8 Pro - Build 9200. I tried several methods but couldn't get any of them to work. This one, however, fixed it.

You need to change the binded IP address for HTTP.SYS

netsh http add iplisten ipaddress=::

http://www.mikeplate.com/2011/11/06/stop-http-sys-from-listening-on-port-80-in-windows/

Dave
  • 25,297
  • 10
  • 57
  • 69
neojp
  • 431
  • 4
  • 3
  • This solution is great, when you need to both run a server that does not use http.sys, and one that does. – Thor Jacobsen Feb 11 '13 at 21:29
  • 1
    Also worked for me. What does it actually do though? – akame Sep 10 '15 at 20:44
  • 3
    I thought this fixed my issue because it did free up the port but it also had some other side effects. Specifically, I was unable to bind to specific hostnames via IIS after this change. To undo I used `netsh http delete iplisten ipaddress=::` – cchamberlain Mar 07 '16 at 01:52
  • This worked for me, but had side effects. Please see my answer below for a possible alternative that uses the same command, but a different IP address. – Dave Morton Apr 24 '17 at 16:56
7

On my case it was WebMatrix. See possible solutions (including this one) here: http://www.sitepoint.com/unblock-port-80-on-windows-run-apache/

Basically:

Open Services from Administrative Tools and locate “Web Deployment Agent Service”. Stop the service and set it’s startup type to “Manual”.

The Web Deployment Agent Service is deployed with WebMatrix and was the cause of my woes. It may also be distributed with other applications installed using Microsoft’s Web Platform Installer.

Martín Coll
  • 191
  • 1
  • 3
6

PID 4 is hard coded to be the "System" process which is part of the system kernel.

If the port is occupied by the system, you probably had IIS enabled. See https://stackoverflow.com/questions/1430141/port-80-is-being-used-by-system-pid-4-what-is-that

billc.cn
  • 7,099
  • 20
  • 36
3

While using the command netsh http add iplisten ipaddress=:: did, indeed, allow Apache to start on my Windows 10 64 bit system, it wreaked havoc with trying to access localhost, as that was bound to :: instead of 127.0.0.1, even with the proper entry in my hosts file. What I ended up doing was to use this command instead: netsh http add iplisten ipaddress=0.0.0.0 This not only worked, but allowed browser access to localhost as well. For me this was a superior solution.

Dave Morton
  • 173
  • 5
  • While you method didn't work for me (I still get a 404 page from an unknown web server running locally) it did make me try to go to http://127.0.0.1 which works as a workaround as long as you remember it – Anders Sandberg Nordbø Jan 07 '20 at 17:19
  • Just found out, if you tried to add :: you need to delete :: as well, then it will work with http://localhost as you described – Anders Sandberg Nordbø Jan 07 '20 at 17:21
3

Open the Services list Find "World Wide Web Publishing Service" Stop it, and set it to Manual

Aaron
  • 171
  • 1
  • 6
0

I had process blocking a port that I needed to use for a docker container and it took forever to resolve. In my case it was PID 4 using port 80 too.

Thought I'd summarise all of the potential issues and solutions I found while trying to resolve - hopefully useful for someone else in future.


For anyone new coming to this, you can investigate the service using the respective port by following these steps to try to figure out what it is.

In Powershell we can check for what process is using this port:

netstat -aon | findStr /i "LISTENING"  | findStr ":80"

To check what process this is:

tasklist /FI "PID eq 4"

Another way to get the process ID using the port:

Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess

Check whether the port has ben reserved for use by another process with:

netsh int ipv4 show excludedportrange protocol=tcp

Also look in Resource Monitor to see if that gives you any more clues.


I tried all of the suggestions I found here and in other posts:

None of these worked to free up the port.

In the end I decided to check for any recent Windows Updates that could have caused it - there was nothing new in the last two weeks.

But when I check for recently installed applications (using Bulk Crap Uninstaller - it's excellent!) I noticed two 'apps' installed yesterday which I definitely didn't manually install so I think they somehow came through Win Update or an auto app update:

  • Microsoft Edge Webview 2 Runtime
  • Web Components

After uninstalling these, I had access to port 80 again!

To make sure it wouldn't happen again, I reserved the port for my own use:

netsh int ipv4 add excludedportrange protocol=tcp startport=80 numberofports=1
  • Please do not post the same answer to multiple questions. If the same information really answers both questions, then one question (usually the newer one) should be closed as a duplicate of the other. You can indicate this by [voting to close it as a duplicate](https://superuser.com/help/privileges/close-questions) or, if you don't have enough reputation for that, [raise a flag](https://superuser.com/help/privileges/flag-posts) to indicate that it's a duplicate. Otherwise tailor your answer to this question and don't just paste the same answer in multiple places. – DavidPostill Apr 26 '23 at 07:04