开发者

Can't start Apache on Windows Server 2008 R2

I got the following error when trying to start apache:

(OS 10013)An attempt was made to access a socket in a way forbidden by its access permissions. : make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down. Unable to open logs

I could start it before. I guess after I enabled feature of windows '.NET Framework 3.5'. now I can't start it properly. I have checked the port:

netstat -aon|findstr "80"
 TCP    0.0.0.0:80             0.0.0.0:0              LISTENING    开发者_高级运维   4
 TCP    [::]:80                [::]:0                 LISTENING       4
tasklist|findstr "4"
System Idle Process              0 Services                   0         24 K
System                           4 Services                   0        304 K

How to resolve this?


After searching for a solution online, I saw people blaming MS SQL reporting services, all MS SQL services, Windows Remote Management service etc. But one post had a helpful diagnostic command that allowed to to track the listening service to w3svc.

TMG is Unable to Listen on Port 80 (no IIS was not installed) by Ori Yosefi, MSFT, October 15, 2010

    e:\DIR>netsh http show servicestate

    Snapshot of HTTP service state (Server Session View):
    -----------------------------------------------------

    Server session ID: FF00000320000001
        [..]
        URL group ID: FE00000340000001
                [..]
                Registered URLs:
                    HTTP://*:80/

    Request queues:
        Request queue name: DefaultAppPool
            [..]
            Controller process ID: 2724
            Process IDs:
                5412

I could see the services running under the detected PID using the tasklist command.

    e:\DIR>tasklist /svc
    [..]
    svchost.exe                   2724 W3SVC, WAS
    [..]

I could inquire configuration details of these services.

    e:\DIR>sc qc w3svc
    [SC] QueryServiceConfig SUCCESS

    SERVICE_NAME: w3svc
            TYPE               : 20  WIN32_SHARE_PROCESS
            START_TYPE         : 2   AUTO_START
            ERROR_CONTROL      : 1   NORMAL
            BINARY_PATH_NAME   : C:\Windows\system32\svchost.exe -k iissvcs
            LOAD_ORDER_GROUP   :
            TAG                : 0
            DISPLAY_NAME       : World Wide Web Publishing Service
            DEPENDENCIES       : WAS
                               : HTTP
            SERVICE_START_NAME : LocalSystem


    e:\DIR>sc qc was
    [SC] QueryServiceConfig SUCCESS

    SERVICE_NAME: was
            TYPE               : 20  WIN32_SHARE_PROCESS
            START_TYPE         : 3   DEMAND_START
            ERROR_CONTROL      : 1   NORMAL
            BINARY_PATH_NAME   : C:\Windows\system32\svchost.exe -k iissvcs
            LOAD_ORDER_GROUP   :
            TAG                : 0
            DISPLAY_NAME       : Windows Process Activation Service
            DEPENDENCIES       : RPCSS
            SERVICE_START_NAME : LocalSystem

I could not stop them from command line running as a regular user.

    e:\DIR>net stop w3svc
    System error 5 has occurred.

    Access is denied.


    e:\DIR>net stop was
    The following services are dependent on the Windows Process Activation Service service.
    Stopping the Windows Process Activation Service service will also stop these services.

       World Wide Web Publishing Service
       Net.Tcp Listener Adapter
       Net.Pipe Listener Adapter

    Do you want to continue this operation? (Y/N) [N]: y
    System error 5 has occurred.

    Access is denied.

Then I stopped World Wide Web Publishing Service through the Services GUI, services.msc. I also changed the startup type for this service to Manual. No service listened to TCP port 80 after that.

    e:\DIR>netstat -ano
    [..no process listening on TCP port 80..]


Perhaps you've hit the TCP time-wait state? http://msdn.microsoft.com/en-us/library/ms819739.aspx

"TIME-WAIT makes certain that enough time has passed to ensure that any TCP segments that might have been misrouted or delayed are not delivered unexpectedly to a new, unrelated application with the same connection settings. RFC 793: Transmission Control Protocol DARPA Internet Program Protocol Specification specifies the length of time that a socket pair should not be reused as two maximum segment lifetimes (MSL), or four minutes. This time period is the default setting for Windows Server 2003 TCP/IP."

Server applications often use the SO_REUSEADDR socket-option so they can be quickly restarted, but perhaps your build of Apache doesn't?

You'll know if it 'just works' after four minutes. :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜