While running through some changes I’d made to a form the behaviour of HttpSessionState became erratic, randomly returning either null or the value I had set. I fired up DebugView and captured this trace:

Here, three different threads are shown serving the page requests and, as I would expect, only one thread is returning the value I had set.
This sounded like a configuration issue so I had a look in IIS Manager and found the application pool was configured to be a Web Garden

This now made sense as my form was using InProc sessions handling and Web Gardens behave like a single machine Web Farm, requiring a StateServer for session handling.
The solution to my problem was simple, set the value to 1 as I don’t need the resilience of a Web Garden. If you do though Nicholas Piasecki, has a great write up here.
No comments:
Post a Comment