Session Timeout Event never happens?

Discussion in 'ASP .Net' started by Tim W., Dec 19, 2004.

  1. Tim W.

    Tim W. Guest

    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 ()
    Tim W., Dec 19, 2004
    #1
    1. Advertising

  2. 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
    ===========
    "Tim W." <> wrote in message
    news:%...
    > 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 ()
    >
    Juan T. Llibre [MVP], Dec 19, 2004
    #2
    1. Advertising

  3. Tim W.

    Tim W. Guest

    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

    "Juan T. Llibre [MVP]" <> schrieb im Newsbeitrag
    news:e4$...
    > 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
    > ===========
    > "Tim W." <> wrote in message
    > news:%...
    >> 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 ()
    >>

    >
    >
    >
    Tim W., Dec 19, 2004
    #3
  4. Tim W.

    bjc Guest

    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.


    "Tim W." <> wrote in message
    news:%...
    > 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
    >
    > "Juan T. Llibre [MVP]" <> schrieb im Newsbeitrag
    > news:e4$...
    > > 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
    > > ===========
    > > "Tim W." <> wrote in message
    > > news:%...
    > >> 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 ()
    > >>

    > >
    > >
    > >

    >
    >
    bjc, Dec 20, 2004
    #4
  5. 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.)
    Steven Cheng[MSFT], Dec 20, 2004
    #5
  6. 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
    ===========
    "Tim W." <> wrote in message
    news:%...
    > 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
    >
    > "Juan T. Llibre [MVP]" <> schrieb im Newsbeitrag
    > news:e4$...
    >> 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
    >> ===========
    >> "Tim W." <> wrote in message
    >> news:%...
    >>> 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 ()
    >>>

    >>
    >>
    >>

    >
    >
    Juan T. Llibre [MVP], Dec 20, 2004
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Soren Kuula
    Replies:
    1
    Views:
    438
    Henry S. Thompson
    Dec 1, 2005
  2. Kevin
    Replies:
    4
    Views:
    410
    Irrwahn Grausewitz
    Oct 17, 2003
  3. Kamilche

    Wow, THAT never happens in C!

    Kamilche, Jun 28, 2004, in forum: Python
    Replies:
    1
    Views:
    250
    Peter Hansen
    Jun 28, 2004
  4. NM
    Replies:
    6
    Views:
    450
    Default User
    Sep 20, 2006
  5. Mark Probert

    Timeout::timeout and Socket timeout

    Mark Probert, Oct 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    1,268
    Brian Candler
    Oct 6, 2004
Loading...

Share This Page