Question

There are some systems within a .NET project I'm working on which use StateServer. We're now using Appfabric cache for caching some stuff which we get from DB. Can these two co exist in the same config file?

The session state part of my Config file looks like this

<sessionState mode="StateServer" cookieless="true" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes" regenerateExpiredSessionId="true" timeout="30" stateNetworkTimeout="30"/>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
  <providers>
    <!-- specify the named cache for session data -->
    <add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="default" />
  </providers>
</sessionState>

Obviously, this throws an error that session state is already defined and that i cant re-define it.

Till we replace StateServer systems with Appfabric Caching systems ,which will take some time for us (its a very big project), we dont want to disturb the existing systems. Hence this question.

Was it helpful?

Solution

No, you can only have one unique active session state provider at the same time and it is also not possible to dynamically change at runtime.

In past, I also investigated this article in order to create a session store wrapper. Finally, I gave up because of complexity and poor performance.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top