Being on the Azure cloud, I found that the firewalls there drop connections between the Web server and the database quite often. Mostly when there was some inactivity, I think something between 5 and 10 minutes. So I did some research and found this seems to be a common issue.
So it boils down to a way Firewalls handle TCP connections:
It's a very common issue, when you are behind a NAT proxy or a firewall, to be disconnected without a reason. This behavior is caused by the connection tracking procedures implemented in proxies and firewalls, which keep track of all connections that pass through them. Because of the physical limits of these machines, they can only keep a finite number of connections in their memory. The most common and logical policy is to keep newest connections and to discard old and inactive connections first.
(from TCP Keepalive HOWTO)
Does this mean a firewall/NAT can drop TCP connections whenever it wants? Like after 2 seconds inactivity? Or is there something that prevents us from fearing that no connection is safe from the firewall?