Session Timeout Event never happens?

T

Tim W.

Folks.

In a B2B Procurement system we've created, we got following Session-Issue:

Configuration: We are using IIS 6.0 and added SQL-Based-Sessions in
web.config with a timeout of 240 minutes and set them to cookieless mode.
As well we added Session.Timeout=240 in asp.net-application and saved data
into the session.

Session-Timeout in IIS is also set to 240.

When looking at the ASPStateTempSessions table, we can see Expires field
which has the correct expirery-value.

Problem: We don't ever get any timeout. Session seems to be still alive
after 14 hours. If we call session with session-id in url, we get all values
we set before out of the session.

As well we tried to set session-timeout to 1minute, but same thing happened
(in application and IIS and web.config) Also we tried to disable
Session-State in IIS. But everytime the same result: Session gets not
destroyed (Session.Abandon()) after expirery-time passed.

Did we overlook something? What keeps the session alive?

Thanks for help in advance,

Tim ([email protected])
 
J

Juan T. Llibre [MVP]

Is SQL Server Agent running ?

See http://www.dbazine.com/cook9.shtml

"The InstallSqlState.sql script creates a job called
ASPState_Job_DeleteExpiredSessions to delete
expired sessions from tempdb.

Recall that ASP.NET does not keep session resources
alive indefinitely. To support this feature when a SQL Server
is used to maintain state, the SQL Server Agent must be running
so that the expired session deletion job runs as needed.

By default, the job is scheduled to run every minute. It deletes
session state rows with an Expires value less than the current time.

The account under which the SQL Server Agent runs must have the
privilege to execute the DeleteExpiredSessions stored procedure."

---000---

If SQL Server Agent isn't running,
The DeleteExpiredSessions job can't run.

I hope that's it!



Juan T. Llibre
===========
 
T

Tim W.

Hi Juan,

first checked whether Agent is running: it is! Nonetheless: I don't think
ASPStats_Job_DeleteExpiredSessions is registered. How can I make sure,
and is there a way to setup this job other than re-installing the whole IIS?

Tim
 
B

bjc

Hi Tim - Does your code close all data connections (duh)? Try setting
everything that has anything to do with data or a recordsets to null.
 
S

Steven Cheng[MSFT]

Hi Tim,

I think Juan's suggestion is correct. To enable the SQLserver's auto
deleting on expired session item, we need to ensure that the SQL Agent is
running. In addition, based on my test, When we start a IE browser instance
to visist a sqlserver session app's page, the session will always remain
the same no matter it has been timeout during the post backs or not. But
this doesn't means that the session record in the SqlServer will alwasy
remain, in fact, the record in the sqlserver will be deleted correctly when
it is expired. You can make a simple page( in a sql session webapp with
timeout = 1 min). You'll found the certain session record will be deleted
from the database after timeout timespan, but when you request the page
again, a new record is created, and the displaying SessionId in asp.net is
still the same.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
J

Juan T. Llibre [MVP]

Hi, Tim.

Reinstalling IIS is not needed.

What you need to do is make sure that the
DeleteExpiredSessions stored procedure
is run by a SQL Server Agent as a job.

The InstallSqlState.sql script should have created the
job called ASPState_Job_DeleteExpiredSessions.

If, for any reason at all, that didn't happen,
look for InstallSqlState.sql in the .
%windir%\Microsoft.Net\Framework\v1.1.4322 directory,
if you're using .Net Framework 1.1, or the appropiate
version number directory if using a different version.

If you don't have critical data yet, it probably would be
easier to drop the whole shebang by running the
"UninstallSqlState.sql" script found in the same directory,
and then reinstalling it by running InstallSqlState.sql again
( using SQL Server Query Analyzer for both ).

Then, make sure that SQL Server Agent
is run automatically when Windows starts
( Administrative Tools -> Services, look for SQL Server Agent,
and set to automatic startup )

That should get you up and running.

Let us know how you make out.

I will not be available after tomorrow ( 2 week vacation ),
but there's any number of good people here who can help.



Juan T. Llibre
===========
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top