TeamCity Stopped Working After Installing Web Deploy

September 10th 2015 Web Deploy TeamCity

After the last reboot my TeamCity build server suddenly stopped working: 404 errors were returned instead of TeamCity dashboard. Since TeamCity Server service was still running, I checked the TeamCity log file in C:\TeamCity\logs\catalina.2015-09-09.log:

Caused by: java.net.BindException: Address already in use: bind
    at sun.nio.ch.Net.bind0(Native Method)
    at sun.nio.ch.Net.bind(Net.java:437)
    at sun.nio.ch.Net.bind(Net.java:429)
    at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
    at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
    at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:473)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:646)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:434)
    at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)

The reason became obvious. Some other process was already listening at port 80 when TeamCity was starting up. It must have been something new I installed since the previous reboot. Only Web Deploy came to mind, maybe it installed IIS as a dependency? No, there was still no IIS or w3wp.exe present.

It was time to run netstat -ano to see open network connections. The following line piqued my interest:

  TCP    [::]:80                [::]:0                 LISTENING       4

Indeed, there was a process listening on port 80, but PID 4 belongs to System which isn't really helpful. Finally Antony's answer on StackOverflow brought me on the right track: supposedly there's a Web Deployment Agent Service which has a bad habit of taking over port 80. And it sounds somehow related to Web Deploy. A quick look at the services on the build server confirmed the suspicion. This service was running there. I stopped it and restarted the TeamCity Server service. A couple of seconds later the dashboard was responding again.

To prevent the problem from reoccurring after the next reboot, I still had to disable the Web Deployment Agent Service. I have no need for it; that wasn't the reason I was installing Web Deploy on the server. Problem solved.

Get notified when a new blog post is published (usually every Friday):

Copyright
Creative Commons License