I'm not sure if this is the recommended approach, but here is some code from when I was playing with ConnectionPoolSettings.GroupName a few weeks ago (using different GroupNames can be used to force more TCP connections to be created):
public class PoolGroupTcpBinding : NetTcpBinding
{
private string _groupName;
public PoolGroupTcpBinding(string groupName) : base(SecurityMode.None, false)
{
_groupName = groupName;
}
public override BindingElementCollection CreateBindingElements()
{
BindingElementCollection result = base.CreateBindingElements();
result.Find<TcpTransportBindingElement>().ConnectionPoolSettings.GroupName = _groupName;
return result;
}
}
You should be able to use the same technique to modify the IdleTimeout, something like:
result.Find<TcpTransportBindingElement>().ConnectionPoolSettings.IdleTimeout = timespan;