Sitecore 8.1 error: "No session Id managers were found to manage the session Id for the current request"

3k views Asked by At

I'm attempting to get a basic layout up and running in Sitecore 8.1, and I've hit an error about which I can find very little information. When attempting to view any page (even the backend interface or connecting from Sitecore Rocks), I get the message "No session Id managers were found to manage the session Id for the current request."

Some Googling suggests that this has to do with some issues with the out-of-box session provider and recommends swapping it out for keeping the sessions in Mongo. Sitecore's documentation provides a description of this, both for shared and private sessions. I've attempted to implement those but continue to receive the same error.

Here's my code as it stands now:

App_Config/Include/MongoSessionProvider.config

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <tracking>
      <sharedSessionState>
        <providers>
          <clear/>
          <add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionProvider, Sitecore.SessionProvider.MongoDB" connectionString="session" pollingInterval="2" compression="true" sessionType="shared"/>
        </providers>
      </sharedSessionState>
    </tracking>
  </sitecore>
</configuration>

App_Config/Include/ConnectionStrings.config (excerpt)

<add name="session" connectionString="mongodb://localhost/sharedsession" />

Web.config (excerpt)

<sessionState mode="Custom" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.FXM.SessionManagement.ConditionalSessionIdManager" customProvider="mongo">
  <providers>
    <add name="mongo" type="Sitecore.SessionProvider.MongoDB.MongoSessionStateProvider, Sitecore.SessionProvider.MongoDB" sessionType="Standard" connectionStringName="session" pollingInterval="2" compression="true" />
    <add name="mssql" type="Sitecore.SessionProvider.Sql.SqlSessionStateProvider, Sitecore.SessionProvider.Sql" sessionType="Standard" connectionStringName="session" pollingInterval="2" compression="true" />
  </providers>
</sessionState>

Note that this is on my local development machine. I have Mongo running (and confirmed its connection to Sitecore), and I created both the session and sharedsession databases in it using use session and use sharedsession, which I understand to be the way to create DBs in Mongo.

Am I missing something here? Or does the error simply not mean what I think it means?

2

There are 2 answers

0
James Skemp On BEST ANSWER

In case it helps anyone else, we were running into this issue as well after upgrading to Sitecore 8.1 rev. 151003.

In our particular case the issue was with a namespace change in this line in the Web.config:

<sessionState mode="InProc" cookieless="false" timeout="20"
 sessionIDManagerType="Sitecore.FXM.SessionManagement.ConditionalSessionIdManager">

That should be the following:

<sessionState mode="InProc" cookieless="false" timeout="20"
 sessionIDManagerType="Sitecore.SessionManagement.ConditionalSessionIdManager">

It might have been something we missed in the upgrade guide, but we finall found it after pulling down the a copy of Sitecore 8.1 rev. 151003.zip from the downloads page.

11
Dmytro Shevchenko On

The message you are seeing is not supposed to be an error, it is rather a log warning. It is related to retrieving the configuration of the Session ID Manager rather that to the configuration of the session itself.

Why this warning normally appears

In the Sitecore.config under <pipelines> there's the getSessionIdManager pipeline defined.

<getSessionIdManager>
</getSessionIdManager>

In the Sitecore.FXM.config, there is a processor configured for this pipeline:

<getSessionIdManager>
  <processor type="Sitecore.FXM.Pipelines.ChooseSessionIdManager.FXMSessionIdManagerProcessor, Sitecore.FXM" />
</getSessionIdManager>

This pipeline allows to dynamically select a Session ID Manager for the request. In the default Sitecore configuration, a non-default Session ID Manager will be used only for requests with explicit sessionId URL parameter, i.e. for FXM requests only.

For all other requests, no Session ID Manager will be explicitly selected, and the default System.Web.SessionState.SessionIDManager will be used; this is reflected in the warning message you're seeing. There is nothing wrong with this situation per se, this is by default and by design.

Seeing the message as an error on every page request

This definitely sounds like a defect to me. This message is supposed to be logged once per application lifetime instead of being thrown as an exception on every page.

You should report this to Sitecore support.

An attempt to fix

I cannot debug your system, so I have to do this blindfolded. I would try to create you own Session ID Manager selector:

public class CustomSessionIdManagerProcessor
{
    public void Process(GetSessionIdManagerArgs args)
    {
        if(args.SessionIdManager == null)
        {
            args.SessionIdManager = new System.Web.SessionState.SessionIDManager();
        }
    }
}

Configure it as the last processor in the getSessionIdManager pipeline. This will make sure that there is always an explicitly selected Session ID Manager and should hopefully prevent the error from happening.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <pipelines>
      <getSessionIdManager>
        <processor type="YourNamespace.CustomSessionIdManagerProcessor, YourAssembly" />
      </getSessionIdManager>
    </pipelines>
  </sitecore>
</configuration>