Session Loss In Webgarden
In webGarden scenario application pool can have multiple worker process assigned to it.
In this case there are possiblilities like users first requests get served by workerprocess A and second request
get served by worker process B. assuming you are using In-proc session, in above scenario your worker process A
has user session and worker process B was not aware of it so when user tries to request the page and page was serverd by worker process B.
Then ultimately user will be asked to reinitiate the session.
To overcome this situateion you need to mark the objects of classes who participate into session storing mechanisum as serializable
and you need to define the storage space for Session values like Application state server or SQL server for maintaining session state.
Why do we need to mark the classes a serializable?
Objects while crossing the boundries of application they need to mark as serializable otherwise it's not posible for them to cross the boundries.
Application Pool recycling and session values
When application pool pro-actively or re-actively recycles the healty/ un-healthy worker process and incase you are using in-process memory for
storing the session values, you will loose the session values. To avoid loosing session values use out of process session storing mechanisum.
use either SQL server or State server.
In web farm scenario multiple machine act like single one using Network load balancing cluster. In this case there are possibilities that
first request get serverd by Machine A and second request get server by machine B of NLB cluster. If session get stored in Machine A's in process,
how is it possible to have those session value at machine b's in process. To avoid this we need to store session values as shared resource like
SQL server or State server.
I learned NLB using this article http://www.west-wind.com/presentations/loadbalancing/networkloadbalancingwindows2003.asp
To let SQL server participate into session storing mechanisum you need to execute aspnet_regSQL with appropriate switch.