Sitecore 9: Redis Private SessionState Configuration
If you are using Redis for your Sitecore 9 Private SessionState Provider on Content Delivery Servers and follow the Sitecore documentation for Update 1 located at: https://doc.sitecore.net/sitecore_experience_platform/setting_up_and_maintaining/session_state/session_state/walkthrough_configuring_a_private_session_state_database_using_the_redis_provider, you are likely to experience the following error:
StackExchange.Redis.RedisConnectionException: No connection is available to service this operation: EVAL
This is because Sitecore’s documentation for the Web.config changes are not currently accurate, as they state to use the following:
<sessionState mode="Custom" customProvider="redis" timeout="20">
<providers>
<add name="redis"
type="Sitecore.SessionProvider.Redis.RedisSessionStateProvider,
Sitecore.SessionProvider.Redis"
connectionString="session"
pollingInterval="2"
applicationName="private"/>
</providers>
</sessionState>
But this only applies to Sitecore version 8, where in Sitecore 9 you should leverage the sessionIDManagerType which allows you to declare the desired provider by changing the mode to “Custom” and adding customProvider=”redis” to the sessionState tag. Doing so not only allows you to use Redis as your Private SessionState Provider, but since the sessionIDManagerType allows you to declare your desired Provider choice, you can leave the other entries in for mssql or mongo (note: to restore to an InProc SessionState, you would change the mode to “InProc”).
In essence, change the default sessionState configuration settings from:
<sessionState mode="InProc" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.SessionManagement.ConditionalSessionIdManager">
<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"/>
<add name="redis" type="Sitecore.SessionProvider.Redis.RedisSessionStateProvider, Sitecore.SessionProvider.Redis" applicationName="Application"
connectionString="session" pollingInterval="2" compression="true"/>
</providers>
</sessionState>
To:
<sessionState mode="Custom" cookieless="false" timeout="20" sessionIDManagerType="Sitecore.SessionManagement.ConditionalSessionIdManager" customProvider="redis">
<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"/>
<add name="redis" type="Sitecore.SessionProvider.Redis.RedisSessionStateProvider, Sitecore.SessionProvider.Redis" applicationName="Application"
connectionString="session" pollingInterval="2" compression="true"/>
</providers>
</sessionState>