Question

I like to host asp.net web application in IIS 7.0 (windows server 2008).

I configured session state as sessionstate mode="inproc" timeout = 120. Even the session expires within 15 seconds. What could be the problem?.

Thanks

Was it helpful?

Solution

Check the Windows Event Log to ensure that the Worker Process is not being forced to recyle.

There may be something in your code that causes the Worker Process to force itself to recyle in which case when the session is stored inProc it will loose all session values it's holding.

OTHER TIPS

You can check your connection timeout in these 2 areas. enter image description here

enter image description here

OR

Advanced settings

sounds like the session timeout is set incorrectly in the web.config you could try something like:

<system.web>
    <sessionState timeout="2" />

to set the timeout to 2 minutes

http://msdn.microsoft.com/en-us/library/h6bb9cz9(vs.71).aspx

Mmerrell wrote this and is key to find the origin of problem:

Check the Windows Event Log to ensure that the Worker Process is not being forced to recyle.

There may be something in your code that causes the Worker Process to force itself to recyle in which case when the session is stored inProc it will loose all session values it's holding.

Look at the Event viewer on "Windows logs/system", you are looking for a "WAS" Source event that contains a description like: "A worker process with process id of '2980' serving application pool 'SIAC' was shutdown due to inactivity. Application Pool timeout configuration was set to 20 minutes. A new worker process will be started when needed." this is the symptom you are looking for.

Event viewer with the WAS event

Hope this helps.

Had nearly same problem with HTTP handler written in C# using SessionState. Seems the property IsReusable should be false otherwise I was running in the problem of session loose.

Thanks Mmerrell for his Response, which brought me on right track.

There also another thing to check - App Pool Advanced settings - Virtual memory limit. See if it is explicitly set - as it may recycle automatically once exceeds the set limit. Especially if you are seeing the error in your event log like :

A worker process with process id of '****' serving application pool 'your-app-pool-name' has requested a recycle because it reached its virtual memory limit.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top