Enable-SPSessionStateService; Check your SQL permissions

Enable-SPSessionStateService will do the following:

Creates a session state database and turns on the session state service.

Nice! Everything runs smoothly until the following health rule generates a warning:

Expired sessions are not being deleted from the ASP.NET Session State database.

Strange? Not so. According to the permissions and security settings article, your main account only needs dbcreator and securityadmin rights. But, when you enable the session state service, a job has to be created under the SQL Agent Service, which you need sysadmin rights for. So if your account only has dbcreator and securityadmin at runtime, kindly ask the SQL team to give sysadmin for just a sec.

If you already created the service application with the wrong SQL permissions, you can always manually create a job under the SQL Agent Service to execute the “DeleteExpiredSessions job”.


6 thoughts on “Enable-SPSessionStateService; Check your SQL permissions

  1. Hi Bram,
    according to http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx you need to enable ASP.NET session state:

    1) Enter the following PowerShell command in the SharePoint 2010 Management Shell window:
    Enable-SPSessionStateService –DefaultProvision

    2) On each web application for which you want to use session state, edit the web.config file and set the enableSessionState property of the pages element as follows:
    <pages enableSessionState="true"

    On my development server I did not do point 2 (enableSessionState="false") and it seems to work. Do you know if it is necessary?


  2. Thanks for the post Bram. If the SQL job runs every minute to clean the expired sessions, any idea what is the significance of State Service Delete Expired Sessions timer job? Ideally, this timer job is supposed to kick the DeleteExpiredSessions stored proc to do the clean up operation. Is that corrrect?

  3. Pingback: Deep dive into SharePoint Timer Jobs and Health Rules | Bram Nuyts

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s