Session timing out randomly

I have a really annoying problem as it relates to my .net website/application; the session keeps timing out randomly and I cannot figure out why!

I have set the time-out properties and also on the server they are greater than 20 minutes, but time-out can occur in 2 sometimes!

 I have attached a copy of my web.config. I'd love some help on getting to the bottom of what is happening to my session!

web-config.txt
swgdesignAsked:
Who is Participating?
 
swgdesignConnect With a Mentor Author Commented:
Right so it seems the process idling was causing the timeout even though session timeout was set to 120 minutes!!! Stupid!
0
 
strickddCommented:
Session timeouts can be caused by many factors. I would recommend monitoring your app pool recycles in IIS and see if they are recycling. Also check your code for Session.Abandon() and Session.Clear() calls.

A second thing to check is if you have a load balanced server, make sure that the requests for one user are all going to the same server and that the machine.configs are the same.
0
 
swgdesignAuthor Commented:
Not using Session.clear or Session.Abandon and we are not using a load balanced server

I am just setting various session variables on login. If this is IIS related what could be causing it???

0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
strickddCommented:
The most common causes for IIS causing this type of issue are:

1) Insufficient memory in the application pool. Minimum of 850MB per app pool for .Net 2.0+
2) Memory usage by the application. Looping connection, looping object creation, long running processes, etc.
3) Another application sharing the pool causing an issue. Isolate your applications into separate pools to find the trouble maker.
0
 
swgdesignAuthor Commented:
The application is using it's own application pool("RBP") in IIS7 as follows;
It is integrated and using framework. 2.0 for asp.net 3.5.

Recycling...
Regular time intervals = 1740

Advanced Settings
 Screenshot of application pool settings
How do I set the memory usage for an application pool or website/application?
How do I / Whats the best way to monitor the application to see what is causing the session issue?
(I've never had to do this before so I have no idea where to begin)
0
 
strickddCommented:
This will help with the memory settings:
http://technet.microsoft.com/en-us/library/cc753179(WS.10).aspx

As far as the best way to monitor what is causing it... there is now really good way in general. It all depends on what exactly is happening. I would recommend that you enable tracing in the application and loading different pages to see where load times are taking a while and the look through the code.

I would also search for all FOR loops and WHILE loops and make sure that any used object is declared OUTSIDE the loop.

object MyLoopObj;

for(int i =0; i<someVal; i++)
{
    MyLoopObj = new object();
}

Open in new window


instead of

for(int i=0; i<someVal; i++)
{
    object MyLoopObj = new object();
}

Open in new window


0
 
swgdesignAuthor Commented:
Ok, so I reset a lot of settings this morning on my website and app pool to try and eliminate any issues, it seems to have helped but the timing out issue is still occurring. I have checked the event logs and nothing is being reported back when the website sessions time out, so am I right in thinking this is related to some code somewhere causing the time out???

You mentioned the memory settings above, but you can only set recycle values for the application pool. Is that what you meant? Also, I thought that if the values are not used, the size of memory used does not matter???

Also, the loop issue is something new to me. Is this somehting you have 1st hand experoence of causing session issues or just a guess?
0
 
swgdesignAuthor Commented:
Found out that for some reason under IIS 7 process idle timeout can sometimes cause premature session timeout!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.