I am manually maintaining WCF Session. When client login a GUID is given to the client as sessionId. All others methods have sessionId as parameter that client will provide. Every thing working fine. Now how can i manually manage Session Timeout ?
Asked
Active
Viewed 1,833 times
0
-
What exactly do you mean with "manual mantaing WCF Session"? What is the value of ServiceBehavior.InstanceContextMode for your service? – Jan Dec 16 '10 at 12:14
-
i am not using WCF Session. value of ServiceBehavior.InstanceContextMode is PerCall – Saokat Ali Dec 16 '10 at 12:21
1 Answers
1
Let's first get the fact that you are trying to maintain state between WCF calls, which rather violates the principle in the first place, out of the way first. (Take a look at the question: Manually Handling WCF Session Timeout)
Assuming that you are generating the guid that is the sessionid then you'll need to store that somewhere, a database seems likely. Store the sessionID there with the current DateTime. Each time a request is received, check the store for the sessionID and see if your timeout has been exceeded, if so the dispose of the sessionID and report the state back to the client. If the timeout has not been exceeded then update the DateTime to the now current DateTime and process the request.