I have a .NET MVC web application running on Windows Server 2016, IIS.
When I connect to the application it take over 20 seconds to establish the TCP/IP connection. All subsequent requests are fast. If I wait for about 3 minutes and try again, the problem reappears, same if I try to connect using a new anonymous window, or a different browser. If I connect to the application locally using a browser on the server it works fine. Based on Windows logs, the application pool isn't getting recycled. I tried turning off Windows Firewall temporarily with no luck.
Any idea what I should try?
Fiddler Statistics tab:
Request Count: 1
Bytes Sent: 227 (headers:227; body:0)
Bytes Received: 107 (headers:107; body:0)
ACTUAL PERFORMANCE
--------------
ClientConnected: 11:27:15.867
ClientBeginRequest: 11:27:15.868
GotRequestHeaders: 11:27:15.868
ClientDoneRequest: 11:27:15.868
Determine Gateway: 0ms
DNS Lookup: 0ms
TCP/IP Connect: 21013ms
HTTPS Handshake: 36ms
ServerConnected: 11:27:36.883
FiddlerBeginRequest: 11:27:36.883
ServerGotRequest: 11:27:36.883
ServerBeginResponse: 00:00:00.000
GotResponseHeaders: 00:00:00.000
ServerDoneResponse: 00:00:00.000
ClientBeginResponse: 11:27:36.883
ClientDoneResponse: 11:27:36.883
Overall Elapsed: 0:00:21.014
Chrome devtools timing
Solved with some external help.
This had nothing to do with the server, or the app. The issue was a duplicate DNS A record pointing to a server that is no longer operational.
The client tried to connect there, timed out after 20 seconds and then retried with the second correct record. Then I assume the connection was kept open for a few minutes as long as there was activity so the subsequent pages loaded fine.