Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two development machines, both running Windows 7 Professional.

The first machine is alternately used for IIS 7.0 and Apache 2.2 web servers (but never at the same time). I shutdown IIS, which frees up port 80, then start Apache on port 80. (or vice versa). This works fine.

I have a second development machine on which I need to do the same setup. (different project for a different client). Even when IIS is stopped, port 80 is still in use by a System-level process.

I have not been able to spot the difference that makes one machine work and the other fail. Does anybody else know why port 80 will not release when IIS is stopped?

share|improve this question
add comment

1 Answer

Execute the following command:

netsh http show servicestate

Have a look for entries that look like:

Registered URLs:
    HTTP://+:80/<SERVICE_NAME>

That'll tell you what's listening on port 80.

Watch out for Skype as well, that has a nasty habit of grabbing port 80.

Since Windows 2003, Microsoft created a kernel mode http driver. A feature of this driver is the kernel mode listener. The kernel mode listener provides a feature called port sharing where more than one application can listen on the same port. Applications that wish to do this register a URI namespace for their application. For example on my machine I have the the MS Deployment Agent Service listening on this URL:

http://+:80/MSDEPLOYAGENTSERVICE/

Requests to that particular URI are handed off to the application that registered that particular URI.

IIS is another application that will register itself with the kernel mode listener service and its various bindings.

The problem with Apache on Windows is that it doesn't use the Windows HTTP kernel mode subsystem and register itself (this is not a slight, just a fact of life). It's own process tries to bind directly to whatever ip/port combo you configured. Of course if the HTTP listener service is sitting there listening on URI's registered on port 80 by other services it'll be kicked off.

So basically if you want to use port 80 I think you need to find and kill everything that could possibly be listening there (if you do a Listen 80) on the IP address you want to use for Apache.

If may even be necessary to delete registered URI's that are no longer in use which may not have been properly cleaned up when an application uninstalled itself.

The easiest workaround, not ideal and I'm sure you know it already, may be to configure Apache for Windows to listen on something that's not port 80.

For further reading see:

About HTTP Server API - MSDN

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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