views:

33

answers:

1

I've got two web portals that are almost identical in architecture. One requires that I add the following to my web.config and enabling the state server, as the logged-in user sessions expire after 2-5 seconds:

<sessionState mode="StateServer"
                      stateConnectionString="tcpip=localhost:42424"
                      cookieless="false"
                      timeout="20"/>

I'd like to know what some of the root-causes are that will cause this issue in one web portal but not the other.

This is a C# ASP.Net v3.5 app sitting on Windows 2008 R2.

Strangely enough, on my local dev box (Windows 7), I don't need to enable this, and the sessions last just fine.

Any discussion on this would be appreciated.

A: 

You also need to make sure that you define a machine key, in your servers in the machine.config files, or in your web.config.

I've implemented this scenario successfully on my work servers in a web farm scenario, most recently last week, and it has definitely helped maintain my sessions.

As to why you need to do this ---

The client needs a way to track their session ID. In a farm scenario, depending on traffic, they can be bounced from Server #1 on one page request, to Server #2 on another page request, then back to Server #1 on yet another page request.

This link is pretty helpful.

TheGeekYouNeed
Interesting, however I have both portals on the same box, and as I mentioned, the architecture is basically the same for both... just one's session is gone in seconds...
ElHaix
Try adding a machinekey in the machine.config, turn on the session state service on the box, then adjust the web.config with the xml you posted above and see if that works.
TheGeekYouNeed
TGYN: What I'm trying to figure out is why I need to have the session state service active for one site, and not the other. I've got this successfully working, just wondering about what some of the .Net architectural components are that I've built that may lead to one site requiring the out-of-process sessions state.
ElHaix