Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 496
Andrei Sedoi Avatar asked May 26 '10 08:05

Andrei Sedoi


People also ask

What is reliable session in WCF?

WCF reliable sessions is an implementation of SOAP reliable messaging as defined by the WS-ReliableMessaging protocol. WCF SOAP reliable messaging provides an end-to-end reliable session between two endpoints, regardless of the number or type of intermediaries that separate the messaging endpoints.

What is reliable messaging and transaction?

When both the client and the service implement WS-ReliableMessaging, they can establish a back and forth communication that helps ensure that calls and responses are received. Reliable messaging works over HTTP, TCP, and Named Pipe bindings. Reliable messaging works a little like TCP (the transport part of TCP/IP).

Which configurable property indicates how many messages the reliable sessions transfer window can hold?

The configurable property MaxTransferWindowSize indicates how many messages the transfer window can hold. On the sender, this indicates how many messages the transfer window can hold while waiting for acknowledgements; on the receiver, it indicates how many messages to buffer for the service.


2 Answers

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:

  • Introduction to Reliable Messaging with the Windows Communication Foundation
  • Reliable messaging demystified
  • WCF reliable message delivery
  • Reliable sessions made easy with WCF
like image 177
marc_s Avatar answered Sep 30 '22 11:09

marc_s


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

like image 30
avrahamcool Avatar answered Sep 30 '22 10:09

avrahamcool