Expired sessions are not being deleted

Discussion in 'Databases' started by markpringle, May 2, 2011.

  1. I just started using Winhost and moved over my databases. However, now, my expired sessions are not being deleted from the ASP.NET Session State table: ASPStateTempSessions. The DeleteExpiredSessions stored procedure works fine when run manually. However, it is not being run automatically and this causes my database in increase in size dramatically if I do not manually run the DeleteExpiredSessions stored procedure. What would cause this automatic clearing of expired session to stop if I migrated from one hosting company to Winhost. Help!
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    How do you know that your session is not expiring? What is the session timeout value?
     
  3. The session IS expiring, but the session object stored in the database is not being removed from the table. So, my database gets huge quick, until I manually run the DeleteExpiredSessions stored procedure. From what I understand, the DeleteExpiredSessions stored procedure should be triggered by the Sql Server Agent every minute (not sure about the timeframe), but evidently is not.

    Also, it looks like I need to make sure that the DeleteExpiredSessions stored procedure is run by a SQL Server Agent as a job. Microsoft says the InstallSqlState.sql script should have created the job called ASPState_Job_DeleteExpiredSessions. But, I didn't use this script on the new hosting provider Winhost. I just migrated my database.
     
    Last edited by a moderator: Oct 14, 2015
  4. Ray

    Ray

    Did we create the SQL session schema for you or is it something you created on your end and simply uploaded it to our SQL server?
     
  5. You did not create it. When I moved my database to Winhost, I just restored a backup of my DB from my previous provider. Everything works great, sessions work, they are just not getting deleted from the database when they expire. Do I need Winhost to recreate my SQL session schema?
     
    Last edited by a moderator: Oct 14, 2015
  6. Ray

    Ray

    It maybe better. I suggest you create the SQL session schema on another database and have your application use that for now. If they recreate the schema on the same database, all the objects you have already created for the SQL session maybe lost. And I do not know what the side affect will be on your web application.
     
  7. I did as you suggested and had you guys create a SQL session schema (in a new DB) and that works properly. Evidently, when a user migrates a database, Winhost has to recreate the SQL session schema for it to work properly. There must be something in your schema creation process or script that that I was missing - or things just didn't synch properly. This is important to know for anyone that uses SQL Session states and migrates a DB to Winhost. Thanks for the help.
     
    Last edited by a moderator: Oct 14, 2015

Share This Page