So what these health analyzer rules are reporting about ?
“The State Service Delete Expired Sessions timer job is not enabled ” and “Expired sessions are not being deleted from the ASP.NET Session State database” . Both are talking about expired sessions, is it confusing ? if yes then please read below.
In SharePoint Server 2010, there are two types of state services, State Service & ASP.NET Session State Service. The State Service is used by InfoPath Forms Services (IPFS), the Chart Web Part, and when the user is not running Silverlight Visio Services will use this too. The ASP.Net session State Service is used within aspx pages, controls, Web Parts, etc. to store user/session scoped state such as when you make a call to Page.Session.Add(“Key”, new object()); Todd Carter has a very nice write about both of these here , I’m going to more concentrate on the health analyzer rules and it’s differences.
Whenever you create a new service application you can’t see both them in central administration UI.
The “State Service” can be created from the UI but you have to use Farm Configuration Wizard (used by newbies and for who love the the database names with GUID). I would recommend to use PowerShell to create it.
For creating ASP.NET Session state service, you can’t even use Farm Configuration Wizard , instead you have to use PowerShell. Once you provision it using PowerShell then you can see the service in the manager service applications page.
Here is PS script to create a “State Service” and “ASP.NET session state service”
State Service :
ASP.NET State Service :
After that you can see the services are in the “Manage Service Applications” page.
First we can see the details of the Health Analyzer Rule “The State Service Delete Expired Sessions timer job is not enabled ”. What this guy talking about is whenever we provision a new “State Service”, if you look at the database we can see a stored procedure called “proc_DeleteExpiredItems”
The above mentioned stored procedure is used to clean up the expired sessions in the “State Service” database. The State Service uses a timer job to delete data for expired sessions from the State Service databases. If this timer job is not enabled, the server that hosts the State Service database will run out of disk space and this will be big impact on the SharePoint farm and that is the reason we have this health rule to check if you have the state service enabled then it will check a timer job called “StateServiceExpiredSessionJobDefinition” enabled or not, if not it will throw that message in the central administration UI.
You can enable this timer job either in central administration UI or via PowerShell , I’m giving the PS method below, you can refer the health rule reference article : http://technet.microsoft.com/en-us/library/ff805063
Second health analyzer rule is “Expired sessions are not being deleted from the ASP.NET Session State database”. Once we provision “ASP.NET session state service” it will be creating the database and there is also we can see a stored procedure called “DeleteExpiredSessions”
The main difference with State Service here is , this stored procedure is not executed via a SharePoint Timer Job, instead it is executed by a SQL Server Job handled by the SQL Server Agent. This job will be created automatically when we execute the PowerShell Commandlet “Enable-SPSessionStateService”.
You can find the details of this rule here : http://technet.microsoft.com/library/ff805085.aspx , Always make sure that to check the SQL Server Agent is running and this SQL job registered once you this health analyzer rule reported.
More information about this asp.net session expiry purging stored procedure you can refer the below KB http://support.microsoft.com/kb/973849
Purpose of talking about the stored procedures and SharePoint database schema is for learning purpose only , direct modification of SharePoint DBs is unsupported.