Recently i asked to implement a wcf service. One of the problems i am facing is how to detect network failure and raise fault exception,
after some research , i found that is it possible to set receive time out property to max value, and the inactivity to some time span, basically it works, but my question is am i doing good practice while i doing so?
or anybody have a better way to detect unexpected network failure
I am using tcp binding option
netTcpBind.ReceiveTimeout = TimeSpan.MaxValue;
netTcpBind.CloseTimeout = TimeSpan.MaxValue;
netTcpBind.SendTimeout = TimeSpan.MaxValue;
netTcpBind.ReliableSession.Enabled = true;
netTcpBind.ReliableSession.InactivityTimeout = new TimeSpan(0,2,0);
ReliableSession internally sends infrastructure messages in the specified time interval & verifies whether the TCP session is still alive. This should handle all network related failure errors. Check the below link for details: http://www.blogs.sigristsoftware.com/marcsigrist/post/Prerequisits-for-implementing-a-keep-alive-mechanism-in-WCF-30.aspx