380

I am trying to use port 80 for my application server, but when I perform netstat -aon I get:

TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4

When I look up the process in task manager, it shows PID 4 is SYSTEM, that's it. No extension... nothing. Just "SYSTEM". What's going on here?

I'm afraid to end this process, what do I do?

user4157124
  • 2,452
  • 12
  • 22
  • 36
GiH
  • 11,696
  • 13
  • 40
  • 53
  • Same question at superuser http://superuser.com/questions/352017/pid4-using-port-80 and http://superuser.com/questions/43307/why-is-system-process-listening-on-port-80 – Gábor Imre Nov 26 '14 at 09:20
  • 2
    For future readers, it should be beneficial to read https://serverfault.com/questions/65717/port-80-is-being-used-by-system-pid-4-what-is-that in order to understand why some of the answers posted below worked (but none of the answers went into the level of details). – Lex Li May 18 '20 at 15:56
  • 2
    You are talking about Microsoft Windows right? This should be written down instead of letting the others guess. – pabouk Sep 08 '20 at 14:58
  • Do not include answers to question please (post as separate answer instead). – user4157124 Nov 28 '20 at 22:45

35 Answers35

291

A new service called "Web Deployment Agent Service" (MsDepSvc) can also trigger "System" with PID=4 to listen on port 80.

Antony
  • 5,068
  • 7
  • 24
  • 31
  • 4
    I had the exact same problem as original poster. Antony's answer solved my problem as I didn't have reporting services running. I had recently installed WebMatrix so perhaps "Web Deployment Agent Service" got installed as part of that package. In any event, stopping that service freed up port 80. To take port 80 like that seems pretty brazen, to me. – voam May 20 '11 at 14:37
  • 7
    WebMatrix seems to be the issue here – Jonathan May 23 '11 at 17:46
  • 5
    Yes, I can confirm with Jonathan that after installing WebMatrix (and its dependencies via Microsoft Web Platform Installer), the service "Web Deployment Agent Service" shows up. It is indeed not a very friendly design to use up port 80, especially if you also run Apache/IIS server on the same box. – Antony Jul 07 '11 at 18:03
  • To temporarily stop MsDepSvc, go to Run->"Services.msc", right-click on Web Deployment Agent Service, click Stop. – timofey.com Apr 11 '14 at 18:56
  • You can change the URL for MsDepSvc (Web Deployment Agent Service) here: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MsDepSvc\Parameters – Grynn Nov 14 '14 at 13:23
  • I started having this problem after installing Azure SDK for VS 2012. It either installs or enables this service, apparently. – eselk Nov 11 '15 at 18:06
275

There are many services, which can listen port 80 on windows.

Luckily you can detect and stop them all running simple console command:

NET stop HTTP

When you'll start it, you will get list first: enter image description here

To avoid this problem in future go to Local Services and disable listed services.

N.B. - Some services will restart themselves immediately, just run 'NET stop HTTP' few times.

Anton
  • 9,292
  • 5
  • 41
  • 50
  • 4
    NOTE... run cmd as administrator – boi_echos Oct 27 '15 at 03:37
  • 3
    It will stop the spooler service as well which is responsible for printers. – Ram Mar 25 '16 at 10:20
  • 7
    I missed the subtle fact that you're presented with a list of running services first and the choice to continue with the stopping of them. This allowed me to see what was running, choose not to stop them all, and then find the suspected service in my Services panel, stop it, and set it to manual. Anton's solution is great. Easy to remember and use. – Perry Tew Jun 12 '16 at 21:26
  • @AntonPurin hum ... `net STOP http` is work... thanks a lot bro... was freezen/stuck xampp.. thanks – KingRider Jul 28 '16 at 17:52
  • I get the message "The HTTP service could not be stopped." – barlop Nov 16 '16 at 06:55
  • @barlop check if your console runs as Administrator, if yes - I'm not sure what to do – Anton Nov 16 '16 at 06:57
  • 1
    @barlop this is really odd way to react to people trying to help you – Anton Nov 16 '16 at 08:42
  • @barlop https://support.microsoft.com/en-us/kb/2597817 http://stackoverflow.com/questions/16394192/http-the-service-is-starting-or-stopping-please-try-again-later-error-on-window – Anton Nov 16 '16 at 09:00
  • @AntonPurin re the accepted answer in your second link, obviously I know about task manager, but look at this question it's PID 4, have you ever tried killing the process/"process" with PID 4? I don't think you have. I think you'll find that you are not able to. And while there may be a service that can be stopped that'd stop it, that's not in the answer you linked to with your second link. Your second link is just how to kill a process from task manager and not for PID 4. – barlop Nov 16 '16 at 15:16
  • 3
    Better commands to find the culprit: `netsh http show urlacl` and `netsh http show servicestate` (look for all the ones with :80 in them.) Source: https://www.devside.net/wamp-server/opening-up-port-80-for-apache-to-use-on-windows – Ayub Nov 27 '17 at 01:07
  • Command ran perfectly the first time. But didn't stop the service running on port 80 it seems. It is still showing services running on that port. – Aakash Thakur Nov 28 '17 at 06:10
  • @AakashThakur try run it few times, some services may be instantly restarted – Anton Nov 28 '17 at 06:12
  • I ran it a couple of times and it displays `The service is starting or stopping. Please try again later.` – Aakash Thakur Nov 28 '17 at 06:13
  • @AakashThakur some service stuck, probably. As a permanent solution you can disable autostart for those services and restart. If you simply need to free port once try to restart and run that command again. – Anton Nov 28 '17 at 06:17
  • can you please tell me how do I disablwe autostart?\ – Aakash Thakur Nov 28 '17 at 06:41
  • @AakashThakur that link in my answer leads to a manual how to do that – Anton Nov 28 '17 at 06:44
  • The only that worked for me in Windows 10. Have removed all the inbound firewall rules claiming port 80, and still need to issue this command every time i restart de computer. – David Apr 25 '18 at 17:58
  • `net stop http` apparently lists all registered HTTP services including ones that are not running on port 80. The print spooler, for example, is not on port 80. So you can stop some services manually (Control Panel => Administrative tools => Services) until the port is free. In my case it was one of the SQL server services that used port 80. – Qwertie Jul 04 '19 at 15:08
  • @Ayub Has a good start but if you use `netsh http show servicestate view=requestq` you can actually see the REAL process id which is calling the port. – duct_tape_coder Jun 25 '20 at 20:30
251

Also, try stopping "SQL Server Reporting Services (MSSQLSERVER)", that apparently defaults to 80. I did that and port 80 freed up. PID identified the culprit as "System", but apparently that System can mean multiple things.

Ebrahim Asadi
  • 265
  • 3
  • 12
infocyde
  • 4,020
  • 2
  • 22
  • 34
92

I had the same problem. Could fix it by stopping the World Wide Web Publishing Service under running services.

Jules Colle
  • 9,697
  • 7
  • 50
  • 59
40

the IP adress is 0.0.0.0, state = LISTENING: means that port 80 is listening to all interfaces (not used)

How to read NETSTAT -AN results:

Toby Allen
  • 10,562
  • 10
  • 70
  • 120
manji
  • 45,615
  • 4
  • 87
  • 100
  • 63
    "means that port 80 is listening to all interfaces (not used)" not exactly - the service "World Wide Web Publishing Service" was listening at this port. Once you manually stop it, you might free that port (at least in windows 7) – despot Jan 28 '13 at 12:45
  • 35
    Just to clarify, World Wide Web Publishing Service is W3SVC. Stop this service solves my problem. – daniel__ Aug 08 '13 at 22:41
  • @despot answer was right on the money in my case - windows 10 pro after upgrading from 7Pro, had part of IIS installed which listened on 80. Netstat and SysInternals' tcpview were of no help. – Kitet Sep 22 '16 at 05:33
  • 25
    Stopping and disabling the W3SVC service works for me too: `sc stop w3svc` then `sc config w3svc start= disabled` – dugloon Jan 31 '17 at 22:34
  • 1
    This link ( http://www.devside.net/wamp-server/opening-up-port-80-for-apache-to-use-on-windows ) helped me narrow down the culprits and finally find what I was looking for. Annoyingly this stackoverflow post didn't popup in my searches until I had solved it. – DangerPaws Mar 23 '17 at 21:27
  • 3
    LISTENING means used. It means there's a process using that specific port, waiting for incoming calls. I was trying to start the Default Web Site and IIS told me there's another process using port 80. The most voted answer - the one about "Web Deployment Agent Service" (MsDepSvc) - is a better explanation for what's happening. – Mircea Ion Jul 26 '17 at 23:56
  • 1
    @DangerPaws Thank you for that link! The list of possible services running on port 80 was spot on. For me, `BranchCache` had for some unknown reason started, and was using port 80. – Hans Kristian Apr 16 '19 at 07:02
  • 1
    This answer is not answering the OP question (i.e. why SYSTEM is listening on port 80). And it is wrong (listening != not used). – Fosfor Nov 27 '19 at 11:44
  • Since this is the marked/top answer but not answering the question, I'll put some actually helpful information here: use `netsh http show servicestate view=requestq` and check the process id listed that is actually calling the port. You're welcome. – duct_tape_coder Jun 25 '20 at 20:35
32

It sounds like IIS is listening to port 80 for HTTP requests.

Try stopping IIS by going into Control Panel/Administrative Tools/Internet Information Services, right-clicking on Default Web Site, and click on the Stop option in the popup menu, and see if the listener on port 80 has cleared.

Robert Harvey
  • 168,684
  • 43
  • 314
  • 475
32

This works for me:

  1. Right click on My Computer.
  2. Select Manage.
  3. Double click Services and Applications.
  4. Then double click Services.
  5. Right click on "World Wide Web Publishing Service".
  6. Select Stop.
Eng.Fouad
  • 107,075
  • 62
  • 298
  • 390
28

WORKING SOLUTION TESTED:(WINDOWS 10)

There are many reasona for this, the one cause/solution i recommended is this:

OPEN YOUR WINDOW COMMAND WITH ADMINISTRATOR PREVILEGE THEN:

net stop http /y

the above will agree to stop http service then:

sc config http start= disabled

the above will configure service to disable by default

IF ABOVE SOLUTION DOES NOT WORK FIND YOUR SPECIFIC CASE HERE:

SOURCE: http://www.devside.net/wamp-server/opening-up-port-80-for-apache-to-use-on-windows

RESTART YOUR WEB SERVER/XAMPP/APACHE AND DONE.


If you ever need to re-enable to default here is the command sc config HTTP start= demand the source of explanation is here http://servicedefaults.com/10/http/

Dung
  • 15,167
  • 6
  • 51
  • 49
  • I did it once in the past and it worked. After a windows update, I had the same problem, and this solution worked for me again ! Thanks @Dung – Mikaël Mayer Apr 30 '21 at 07:30
26

I've found out that "SQL Server Reporting Services (MSSQLSERVER)" starts automatically and listens on port 80.

I hope this helps.

O

Omeriko
  • 1,151
  • 11
  • 19
17

An other service that could occupied the port 80 is BranchCache

services.msc showing it as "BranchCache"

or use the net command to stop the service like

net stop PeerDistSvc

Update:

PeerDistSvc is a service behind svhost.exe, to view svchost services type

tasklist /svc /fi "imagename eq svchost.exe"
jones1008
  • 111
  • 1
  • 10
seizu
  • 419
  • 3
  • 9
  • this worked for me as well - the service description says: BranchCache - This service caches network content from peers on the local subnet. – xorcus Sep 21 '16 at 12:52
  • [MSDN: BranchCache Overview](https://technet.microsoft.com/en-us/library/dd637832.aspx) – Yirkha Nov 06 '17 at 11:42
  • [This article](https://2pintsoftware.com/faq-items/can-change-branchcache-port-distributed-mode/) solved my problem with BranchCache – Amit Beckenstein Jan 12 '20 at 09:31
  • Windows Server 2019, uninstalled IIS, BranchCache was the culprit. Wanted to run Kestrel using port 80 and it refused to start with an error: Permission denied at System.Net.Sockets.Socket. Hope this helps someone else looking for a solution. – AlanC Oct 10 '20 at 06:33
12

The issue is how to free it up, simply use

net stop http

https://stackoverflow.com/a/16243333/777982

Community
  • 1
  • 1
Hammad Khan
  • 14,008
  • 14
  • 100
  • 123
9

I knew these answers were right , but my services.msc was not showing the services, however this did the trick:

sc stop "MsDepSvc" 
sc config "MsDepSvc" start= disabled 
isJustMe
  • 5,364
  • 1
  • 28
  • 44
9

This can be very easily fixed by following these five steps:

  1. Open services
  2. Right click on World Wide Web Publishing Service
  3. Click STOP

To prevent this issue in future :

  1. Go to Properties
  2. Change Startup type to Manual

Viola u are good to go !

Arun Joseph
  • 1,536
  • 14
  • 25
4

I just got this problem today, since it showed up after Norton requested reboot I blamed Norton.
But it wasn't Norton, I removed Norton, rebooted -> problem still there.

netstat -nao was showing that PID 4 owned my port 80 connection.

I then went to control panel, then "Turn Windows features on or off" then unchecked Internet Information Services.
Rebooted, the problem went away.
My xampp server is running ok now.

I don't ever remembering turning IIS on in the first place. I had been running many months before this happened. I still don't know what caused it in the first place. Maybe a previous windows updated enabled iis and my reboot turned it on, I don't know.

godzilla
  • 915
  • 1
  • 9
  • 18
4

This Process works for me:

  1. Right click on My Computer.
  2. Select Manage.
  3. Double click Services and Applications.
  4. Then double-click Services.
  5. Right click on "World Wide Web Publishing Service".
  6. Select Stop
  7. Restart XAMPP
Manideep
  • 145
  • 1
  • 9
3

I had this same exact problem, except that i have never used IIS. While I was fixing another system bug, I had set the apache service to manual start, hoping to reduce the complexity of my system. After I fixed the other bug, apache wouldn't start. I futzed for a while, but all it took was setting apache back to automatic start: Start > Administrative Tools > Services.

Apparently when Apache starts this way, it claims port 80 before the SYSTEM process can.

hth someone. all my googling turned up the 'can't have IIS and Apache on the same machine.' this is for the other one percent of us.

changokun
  • 1,513
  • 2
  • 20
  • 27
2

Try netstat -b, that may hopefully shed some light on the situation (showing what .exe is using the port). Good luck.

Jon Onstott
  • 12,491
  • 15
  • 77
  • 128
  • it wasn't even showing up in netstat -b, weird, but anyway I've solved it, look for the update. – GiH Sep 15 '09 at 23:50
  • -1 PID of 4 no use. C:\blah>netstat -abon | more `"Active Connections TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 Can not obtain ownership information"` and after clicking 'show processes from all users' in windows 7 task manager, task manager lists "System" for PID of 4. – barlop Nov 16 '16 at 06:59
2

For me it worked after stopping Web Deployment Agent Service.

danpop
  • 854
  • 12
  • 25
2

In case you use Razer product and install Razer Synapse software on your PC, it blocks the port 80 too.

It is not included in the netstat command so I am not able to troubleshoot it. Since there are many services included within the software, I can't analyze which one that blocks the port. After uninstalling the Razer Synapse, I can start the Apache server again on Windows 10.

maurisrx
  • 309
  • 3
  • 9
  • Thanks I think its the Razer Chroma SDK Server. I disabled it in msconfig and that solved the problem for me! – Stefan Jun 23 '17 at 14:20
1

This wouldn't explain the PID side of things, but if you run Skype, it likes to use Port 80 for some reason.

davidtbernal
  • 12,404
  • 9
  • 41
  • 58
  • I am facing the same problem, the port 80 is acquired by NT Kernal. But when I run Apache on port 80, it does (when configured as run-on-startup service). But when I stop Apache, and try to run Tomcat on port 80, Windows 7 do not allow. The NT Kernel or Skype should not use standard web server port. – Asif Shahzad Jun 13 '12 at 08:49
  • you can change skype's default ports from its 'Connection' settings – Zee Sep 10 '14 at 08:47
1

In my case, it happened after installing Microsoft Web Matrix. Uninstalling this trash along with "Microsoft Web Deploy" fixed the issue.

laurent
  • 79,308
  • 64
  • 256
  • 389
1

None of these worked for me. I had to go to a SuperUser question.

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:

    • 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.

This is the one that worked for me!

Michael
  • 5,910
  • 4
  • 52
  • 74
jason.zissman
  • 2,602
  • 1
  • 16
  • 22
1

I was looking around for PID 4 and came to this question. From this answer and a blog post I figured that anything to do with PID 4 is probably a Windows Service, so you may want to look for the relevant services in services.msc.

Also, this process is run by System, which is considered another "logged-on" user.

Community
  • 1
  • 1
icedwater
  • 4,280
  • 3
  • 31
  • 47
1

I had the same problem and it was because of IIS running on the server, you can stop it using IIS Manager if it is the case for you.

Kamiel Ahmadpour
  • 1,085
  • 10
  • 13
1

If you are running Windows Server 2012 R2 then make sure to get rid of Work Folders: http://blogs.technet.com/b/filecab/archive/2013/10/15/windows-server-2012-r2-resolving-port-conflict-with-iis-websites-and-work-folders.aspx Removing Work Folders feature under File Server worked for me.

1

I stopped World Wide Web Publishing Service and then it worked.

double-beep
  • 3,889
  • 12
  • 24
  • 35
KnuturO
  • 1,141
  • 11
  • 14
1

BranchCache was my problem. My resolution was to run Powershell as an administrator and run:

Disable-BC -Force

Reference: https://docs.microsoft.com/en-us/powershell/module/branchcache/disable-bc?view=win10-ps

double-beep
  • 3,889
  • 12
  • 24
  • 35
1

Identify the process programmatically

All the answers to date have required the user to do something interactive. This is how you find the PID when netstat shows you PID 4, without needing to open some GUI or handle a dialogue about depending services.

$Uri = "http://127.0.0.1:8989"    # for example


# Shows processes that have registered URLs with HTTP.sys
$QueueText = netsh http show servicestate view=requestq verbose=yes | Out-String

# Break into text chunks; discard the header
$Queues    = $QueueText -split '(?<=\n)(?=Request queue name)' | Select-Object -Skip 1

# Find the chunk for the request queue listening on your URI
$Queue     = @($Queues) -match [regex]::Escape($Uri -replace '/$')


if ($Queue.Count -eq 1)
{
    # Will be null if could not pick out exactly one PID
    $ProcessId = [string]$Queue -replace '(?s).*Process IDs:\s+' -replace '(?s)\s.*' -as [int]

    if ($ProcessId)
    {
        Write-Verbose "Identified process $ProcessId as the HTTP listener. Killing..."
        Stop-Process -Id $ProcessId -Confirm
    }
}

That really busted my chops. I hate HttpListener and wish I'd just used Pode.

FSCKur
  • 353
  • 1
  • 9
0

For me I had to uninstall "Citrix Virtual Desktop Agent" on my VM

Jerinaw
  • 4,482
  • 6
  • 34
  • 46
0

PID=4 does not show up in Task Manager even after placing check mark on 'Show processes from all users". Well there is only one user.

However, netstat -b shows multiple connections poiting to the same PID=4 which on this computer displayed the following.

enter image description here

I have only chosen those pertaining to TCP protocol.

This was acquired while trouble shooting IIS which did not start after trying out many others. I do not think you should stop this process.

user2063329
  • 375
  • 1
  • 4
  • 12
0

type netstat -a -n -b -o |more

if stopping World Wide Web Publishing Service helps

then in IIS manager review each site's bindings settings, by selecting a site and on the side panel click on binding. then change port 80 to something else if required.

Shimon Doodkin
  • 3,676
  • 29
  • 33
0

I just went to service and stopped web deployment agent

Jesse Mwangi
  • 161
  • 1
  • 7
0

Also, the "developer portal" (on Windows 10) causes System to listen on a TCP port. Usually ports 50080 and 50443.

Rebroad
  • 123
  • 4
0

netsh http show urlacl

The command is mentioned in a previous comment but I'd like to bring it up as an answer. It will get you all reserved URLs in the system. If you look through all records with "80" in URL, you shall have your answer.

For example, in my case, I got:

Reserved URL: http://+:80/Temporary_Listen_Addresses/
        User: \Everyone
            Listen: Yes
            Delegate: No
            SDDL: D:(A;;GX;;;WD)

Reserved URL: http://+:80/0131501b-d67f-491b-9a40-c4bf27bcb4d4/
        User: NT AUTHORITY\NETWORK SERVICE
            Listen: Yes
            Delegate: No
            SDDL: D:(A;;GX;;;NS)

After a quick Google search, I learnt that "NT AUTHORITY\NETWORK SERVICE" belongs to SQL Server. So I went to Services and stopped SQL Server Reporting Service, port 80 is free again as I check netstat -a -b

PhoenixPan
  • 396
  • 4
  • 16
0

After reading every answer on the question and trying everything, to no avail, I uninstalled and reinstalled XAMPP, which worked.

Edward Tanguay
  • 176,854
  • 291
  • 683
  • 1,015