TeamCity Stopped Working After Installing Web Deploy
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
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
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
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.