Unable to connect to SQL Server session database. – sharepoint error

Recently, i faced an issue with a browser based InfoPath form in SharePoint which kept me on my toes for 2 days.

I was getting the following error:-

Unable to connect to SQL Server session database. The connection string (server=’NDHDEVMOSSSQL’, database=’NDHDev_SharedServices_DB’) was returned by an instance of the IPartitionResolver type ‘Microsoft.Office.Server.Administration.SqlSessionStateResolver, Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’. at System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e)

at System.Web.SessionState.SqlSessionStateStore.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo)
at System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean& usePooling)
at System.Web.SessionState.SqlSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem)
at System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs)
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I found a number of solutions on internet, but none of them worked and later on we found that –

  • The issue was while creating the web application **** credential account was given and the password had expired.
  • So we have to give always service account for each application pool when creating web application for which will teh paswword would not expire.

Other solutions which i tries but didn’t worked were:-
1st:-

1. On SQL Server 2005 Management Studio, below Security – Logins

locate the user that represents your web server, DOMAINMACHINE$.

2. Right-click the DOMAINMACHINE$, choose User Mapping.

3. Map the SharedServices1_DB. check the roles db_owner and public.

4. Click OK and you’re set!

2nd:-
Clsoe all your browsers and clear the browser cache. Somehow the session is getting crashed.

3rd:-
This is due to the hard disk of your sql server is full. remove unnecessary data to free some space.

 

SharePoint error messages: “Unknown Error”

Well, this may sound very basic post to most people, however, being new to sharepoint i myself was very frustated with the error messages that SharePoint generates because the messages don’t give any indication as to what the actual problem is.

The offending message is the dreaded “Unknown Error” message.

 

We know that SharePoint (actually ASP.NET) knows what the error is; it’s just that the framework is keeping that information to itself.

Follow the following steps to get the details of the message:-

  • open the web.config of the site you’re experiencing the problem in (eg. c:inetpubwwwrootwssvirtualdirectoriesmysitenameweb.config)
  • Do a search for “CallStack” and toggle that element to “true”.
  • do a search for “customErrors” and toggle that element to “off”. Save the web.config file.
  • Save the web.config file.
  • Now, If you go back to your site and refresh the page, you should see the actual exception that was thrown and where it was thrown.
  • Lastly, if you did this change in production, you’ll want to change it back, but that probably goes without saying 😉