Redis Cache / NuGet issue

James Phillips asked on May 31, 2020 12:32

Hi, I have a solution which includes the CMS site and MVC site. I have followed the instructions to install the Microsoft.Web.RedisSessionStateProvider package:

However, the package won't install on .NET 4.6.1 as set up by the Kentico installer, so I've updated the MVC site to .NET 4.7.2 and installed Microsoft.Web.RedisSessionStateProvider to the MVC project.

The MVC project compiles and runs fine. However in spite of the fact I have not installed the package on the CMS site, and although the CMS site still builds, it won't run, and gives this error:

Server Error in '/CMS' Application. Could not load file or assembly 'Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Am I missing something? I followed the instructions. I can find no reference to Microsoft.AspNet.SessionState.SessionStateModule in the CMS site at all, so am slightly mystified why this is happening..any help would be much appreciated.

I have deleted everything in the packages folder and refreshed them, but the error persists.

Correct Answer

Dmitry Bastron answered on June 12, 2020 14:59

The documentation says in QnA section it is safe to update the framework version. In our projects we use at least 4.7.2 version, some are on 4.8. I haven't seen any issues caused by .NET framework version with hotfixes or upgrades so far.

I'd recommend upgrading all your projects to 4.7.2 minimum, clean, reinstall Nuget packages, rebuild everything and check again.

2 votesVote for this answer Unmark Correct answer

Recent Answers


Dmitry Bastron answered on June 1, 2020 10:13

Hi James,

Do you have shared projects between CMS and MVC? Have you Updated .NET version for those by any chance? Can shared projects reference SessionStateModule? Is there any particular reason leaving CMS on older .NET version? I'd try the following:

  • Update all your projects in both CMS and MVC solutions to the same .NET version (4.7.2 for example)
  • Check web.config of CMS project, even though it might not be referencing this library in project references, there might be a binding redirect in the config or something
  • Alternatively, try text searching everywhere in CMS folder for "SessionStateModule" keyword, that might give you a clue
1 votesVote for this answer Mark as a Correct answer

J P answered on June 12, 2020 14:28

Thanks for the response Dmitry,

Do you have shared projects between CMS and MVC? Have you Updated .NET version for those by any chance? Yes we have shared project, but have only updated the MVC version.

Is there any particular reason leaving CMS on older .NET version? Yes, I left it because I'm concerned that having a verson different from the default Kentico settings could cause problems when applying hotfixes/updates. Has that ever caused you issues?

I performed the other steps you mentioned..

0 votesVote for this answer Mark as a Correct answer

James Phillips answered on June 12, 2020 16:49

Thanks Dmitry, that sounds like a good plan

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.