Andrei Sedoi
Andrei Sedoi

Reputation: 1544

What is the purpose of WCF reliable session?

The documentation around this topic is poor. I use WCF services with NetTcpBinding hosted in Windows service. The problem is that a session is dropped when it is inactive for some time. What I need is the session which is always alive. Is WCF reliable session something that can help? Or I can just play with timeout settings?

Upvotes: 32

Views: 33882

Answers (2)

marc_s
marc_s

Reputation: 755321

No, a reliable session will time out just like any other session, too. The main question really is: why on earth do you want your sessions to be "endless" ?? If you really need this, you need to crank up the timeouts on the session.

The point of a reliable session is that the caller will know about any messages that are lost. Contrary to popular belief, the reliable session cannot guarantee delivery of a message - but if a message can't be delivered, at least the caller will know about it.

Check out some of these resources for more background info:

Upvotes: 47

avrahamcool
avrahamcool

Reputation: 14094

if you dont use the channel, it will close himself after a while. you can change the default timeout (which is 10 min) from the binding.

NetTcpBinding binding = new NetTcpBinding();
binding.ReceiveTimeout = TimeSpan.MaxValue;
binding.ReliableSession.InactivityTimeout = TimeSpan.MaxValue;

read more at MSDN

Upvotes: 8

Related Questions