The Long and Winding Road to SessionState

Trying to add a ReportViewer web part on a SharePoint page I got this error message:
Session state has been disabled for ASP.NET.
The Report Viewer control requires that session state be enabled in local mode.

Fair enough and Enable-SPSessionStateService -Defaultprovision should solve this for SharePoint 2010. Of course one needs to use SharePoint’s PowerShell console (Microsoft SharePoint 2010 Products | SharePoint 2010 Management Shell) as the default console doesn’t know the commandlet. Unfortunately the command only resulted in a new error message:
Error Category: InvalidData Target Object Microsoft.Office.Server.Administration.EnableSessionStateServiceCmdlet Details NULL RecommendedAction NULL

That wasn’t very informative, so let’s have a look at SharePoint’s log:
System.Data.SqlClient.SqlException: The EXECUTE permission was denied on the object 'proc_putObject', database 'SharePoint2010_Config', schema 'dbo'.

To manage SharePoint one needs to be in the SharePoint2010_Config database’s db_owner role. The virtual machine had been created by the customer’s IT and my user wasn’t in that role. Fixing that (Microsoft SQL Server Management Studio: Databases | Sharepoint2010_Config | Security | Users | [YourUser] | Properties | “General” page | “Database role membership” list) the next try lead to yet another error message:
An update conflict has occurred, and you must re-try this action. The object SessionStateService was updated by [domain]\[user], in the powershell ([process ID]) process, on machine [machine name]. View the tracing log for more information about the conflict.

So SharePoint’s file system cache got out of sync with it’s configuration database and to solve that problem one has to delete a bunch of .xml files and reset a counter. After doing this (see external references) I was greeted by a new error message:
Object reference not set to an instance of an object.

Not very informative again, so what does SharePoint’s log say:
CREATE DATABASE permission denied in database 'master'

So I added my login to the dbcreators role (Microsoft SQL Server Management Studio: Security | Logins | [YourLogin] | Properties | “Server Roles” page). After clearing the file system cache and running the PowerShell command again I found that the SS_WPG account will temporarily need write access to:

  • C:\inetpub\wwwroot\wss\VirtualDirectories\80\web.config
  • C:\Documents and Settings\All Users\Application Data\Microsoft\SharePoint\Config\[GUID]

Finally SharePoint accepted the ReportViewer web part. Moral of the story: when in doubt, check SharePoint’s logs (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS).

External References

Microsoft’s advice on clearing SharePoint’s transaction log
Microsoft’s viewer for SharePoint’s logs

This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your 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