Azure / aspnet-redis-providers

ASP.NET Redis Providers
Other
268 stars 180 forks source link

Error: Provider must implement the class 'System.Web.SessionState.SessionStateStoreProviderBase'. #104

Closed aparker-cityworks closed 6 years ago

aparker-cityworks commented 6 years ago

I had a dev update the package from 2.2.6 to 3.0.2 using Nuget and we are now getting an error in our application: Provider must implement the class 'System.Web.SessionState.SessionStateStoreProviderBase'.

Any idea what might be causing this? Rolling back to 2.2.6 fixes the issue. Are there some other requirements in 3.0.2 that I need to take care of?

footcha commented 6 years ago

Duplicate of #99

I guess your web application is targeting .Net462 or higher. After installing a package Microsoft.Web.RedisSessionStateProvider you should manually update web.config:

<system.webServer>
  <modules>
    <remove name="Session" />
    <add name="Session"
         type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
         preCondition="integratedMode" />
  </modules>
</system.webServer>

Further explanation

Nuget package Microsoft.Web.RedisSessionStateProvider v3.0 was shipped in two different implementations for target frameworks .Net452+ and .Net462+.

See also https://blogs.msdn.microsoft.com/webdev/2016/09/29/introducing-the-asp-net-async-sessionstate-module/

SiddharthChatrolaMs commented 6 years ago

@footcha Thanks for the answer. Closing the issue now

aparker-cityworks commented 6 years ago

Yes, thank you! That did solve the problem.

kunjan13 commented 5 years ago

For me the issue is as it says in the configuration in below line:

 <add name="Session"
         type="Microsoft.AspNet.SessionState.SessionStateModuleAsync, Microsoft.AspNet.SessionState.SessionStateModule, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
         preCondition="integratedMode" />

does it only supports "integratedMode"? My app is hosted on "classic" app pool. I tried with classic app pool and it gives me same error: "Provider must implement the class 'System.Web.SessionState.SessionStateStoreProviderBase'".

IdanLevi commented 4 years ago

@kunjan13 & (under system.webserver) are for integrated mode only. The modules & handlers for classic mode are under:

<system.web>
    <HttpModules/>
    <HttpHandlers/>
</system.web>

That's why the solution above does not work for you.