Long time ago I have created a Powershell script that stops the Apache-service, delete the webserver logs and the start the service again. Have had no issues until recently when the stop-process has started to time out, the well known error "The service did not respond in a timely fashion..".

Well fine, to get around this I updated the script. So very basically explained it now does:

stop-service webserverservice
# Check if process is stil alive, and if found using the PID
stop-process -id $processPid -force

That should take care of it, if stopping the service times out, well, lets just kill the process. And actually doing the last check twice to ensure that no child process are spawened before killing the main process.

BUT - on some servers, not all, and not always either, the above steps are not waterproofed. When starting the server it says

(OS 10048)Only one usage of each socket address (protocol/network 
address/port) is normally permitted.  
: make_sock: could not bind to address
no listening sockets available, shutting down
Unable to open logs

And here is the thing that I cannot explain. Still using Powershell and the netstat equivalent Get-NetTCPConnection

PS C:\temp> Get-NetTCPConnection -LocalPort 80
Get-NetTCPConnection : No MSFT_NetTCPConnection objects found with 
property 'LocalPort' equal to '80'.  
Verify the value of the property and retry.

This leaves me with only one option, reboot the server, and then all is fine again.

Anyone seeing something that I do not, which could explain why I get this problem?

  • = all ip-addresses – HBruijn Aug 10 '18 at 6:55
  • @HBruijn When all is fine, that is - after the reboot - the response will be like Get-NetTCPConnection -LocalPort 80 LocalAddress LocalPort RemoteAddress RemotePort State AppliedSetting ------------ --------- ------------- ---------- ----- -------------- 80 0 Listen But when in the error state, nothing is returned. – rhellem Aug 10 '18 at 10:02
  • You mention child processes; have you double-checked that (when in the error state) no such child processes remain? Also, if the problem started in July, does the server have all the very latest updates? – Harry Johnston Aug 10 '18 at 11:20
  • Yes, I do check that no child process remains. It will have the same name "httpd", so I do search for all processes with that name and then kill by PID. – rhellem Aug 10 '18 at 20:32

It looks like apache is configured to bind to

That means it binds to every IP on the system, on port 80.

So if the host is, for example,, at a minimum apache will attempt to bind to: // localhost // the IP avail

If either of the above has something bound to 80, apache will fail to start, with the error you note on the OP

So there are a few ways to approach this.

First: Modify the apache config to bind only to the IP's that are actually needed. Avoid localhost. Avoid unknown or unused IPv6 or management interfaces.

Second: Use netstat to see what is on port 80.

netstat -a |findstr :80
  • It has been a while since I did ask the question, and somehow managed to miss the answer. But, yes - you are totally right. # IPv4 support: Listen Listen If error reoccurs, I will follow your suggestions. – rhellem Jan 19 '20 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.