Customers periodically ask for a way to enable TCP Keep Alive on the underlying socket for the TCP transport in WCF.  The most often reason I hear this request is to workaround an idle timeout on some intermediary device (like a proxy or load balancer).  However, TCP Keep alive is a hop by hop solution that will usually only solve the problem for the connection between the client and the first intermediary device on the network.  If there are multiple intermediary devices between the client and server, then TCP Keep alive probably won’t solve the problem. 

One team here at Microsoft solved this problem by implementing a KeepAlive WCF Layered channel that sends application-transparent soap messages as necessary to keep the channel alive.  The code was tested quite heavily by the team that implemented it and they agreed to allow us to publish it for others to use.  If you are interested, you can find the code at