Solved

ASP.NET InProc Sessions expiring too early.

Posted on 2006-10-24
15
1,044 Views
Last Modified: 2007-12-19
I am having some issues with web sessions expiring too early.  I am using an InProc Session State Management.

Currently I have the asp.net 2.0 application running on Windows Server 2003.

I created a new applicationp pool for this application and set the "Shutdown worker processes after being idle for..." to 120 minutes.

I have set the Session Timeout in the web.config file to 120 minutes.

I even set the Session Timeout in the Configuration -> Options section to 120 minutes.

For some reason the sessions expire after 30, 20 and sometimes even 10 minutes.  Can someone give me a solution as to why this is happening?
0
Comment
Question by:midavis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
15 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17797835
Is your application recycling?  Are you trapping the Session.End event in global.asax?

Bob
0
 

Author Comment

by:midavis
ID: 17797865
Yesterday I put in some logging for when the application ends but no emails for it yet.  I would really like to be able to log each session start by session id in a log file and when the session ends by session id in a log file to see how long the sessions are lasting.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17797898
You can log those from the global.asax file in the Session_Start and Session_End handlers.

Bob
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:midavis
ID: 17797954
How so?  The sender object does not have what I need and the EventArgs give me nothing.  I would like to be able to log the session id when it starts, ends and the length of time it is going.

However, how is this going to fix my problem?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17798015
That won't help you necessarily, so that is why I was asking if your application is recycling, since that will give you a new session.  Application recycles are written in the log.

Bob
0
 

Author Comment

by:midavis
ID: 17798047
I don't see anything in the event log stating this.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17798074
I found what I was really looking for:

PRB: Session variables are lost intermittently in ASP.NET applications
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316148

HTH
Bob
0
 

Author Comment

by:midavis
ID: 17798097
I will see if the server has antivirus software somehow.  I know we didn't install anything yet and I am not sure if the hosting company has anything running.
0
 

Author Comment

by:midavis
ID: 17798125
Also, if this was the case wouldnt the event log show the server restart?  I am not seeing this.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17798138
Here is another reference:

Use Performance monitor -> ASP.NET -> Application restart counter on daily base.
http://weblogs.asp.net/ngur/archive/2003/11/24/39536.aspx

Bob
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17798267
Since you are using IIS 6.0:

Logging Worker Process Recycling Events in IIS 6.0 (IIS 6.0)

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/87892589-4eda-4003-b4ac-3879eac4bf48.mspx?mfr=true

Bob
0
 

Author Comment

by:midavis
ID: 17798284
I don't see an easy way to install these counters though.
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17798345
1) Open the performance monitor (perfmon)

2) Add a counter

3) Select Performance object = ASP.NET

4) Select Application Restarts

Bob

0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# MVC Insert Multiple Row into DB 2 93
Easy filter aspnet 2 46
Consume a webservice via VB in Visual Studio 2015 3 42
Difference between Leaflet and MapBox? 5 43
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question