I have a WCF service running on IIS.
Every time a user logs in (with username and password) I create a SessionClass that does something every few minutes in a thread and handle user requests.
I save every new SessionClass that's created in a Dictionary in a singleton ServiceClass.
If a user doesn't request anything for a long period of time (let's say 10 hours) the session should die. I kill the thread and remove the SessionClass from the Dictionary in the ServiceClass singleton.
My problem is that every time I remove a SessionClass from the Dictionary, it makes the instance of the ServiceClass null again and the next time its being called, it's being created again so I lose all the sessions I used to hold in the dictionary...
I tried holding direct reference inside the WCF service to the ServiceClass.GetInstance() (I thought that the garbage collector is killing the ServiceClass) but it won't help...
Why is this happening? Any ideas?