Question

i was looking for a article to know that is it possible to open a persistent long connection open between service & client? one msdn article said not possible http://social.msdn.microsoft.com/Forums/vstudio/en-US/bd984f28-4458-4779-9dcd-dc79587711a4/wcf-service-and-force-time-out-after-certain-interval?forum=wcf

the person is saying "Each time the WCF client makes a call to the WCF service, a connection must be opened between the two, credentials are given to the WCF service from the client, the service does its task, and the connection is closed between the client and the service. "

is it true? it is not possible to open persistent connection between service & client? looking for some insight. thanks

Was it helpful?

Solution 2

You can decorate your service class with these attributes to use a session based approach.

[InstanceContextMode=InstanceContextMode.PerSession,
SessionMode=SessionMode.Allowed,
ConcurrencyMode=ConcurrencyMode.Single]

However, you will have to send a heartbeat request to your service to keep the session alive when idle every so often. This is not handled automatically.

OTHER TIPS

There are session based both way connections, witch keeps connection open, until timeout (if there is no activity from client).

See http://msdn.microsoft.com/en-us/library/ms731064.aspx for example.

But if it is not necessary for you to keep connection open, don't do it that way.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top