我们不想为此使用缓存集群,因为到目前为止,我们在缓存集群上面临一些稳定性问题,因此它们一直在维护(完全是我们的错)。我们可以使用专用集群进行会话存储吗?(忘记集群,至少一台主机?)
这就像在同一个应用程序中使用两个集群,一个用于缓存,一个用于会话存储,它们将位于同一个配置文件中。
我的做法对吗?任何帮助,将不胜感激。谢谢!
感谢@CyberMax,我能够设置这个环境。但是,当我运行页面时出现错误:
无法读取配置部分“dataCacheClients”,因为它缺少部分声明
这是我的配置:
<configuration>
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient" type="Microsoft.ApplicationServer.Caching.DataCacheClientSection,Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
allowLocation="true"
allowDefinition="Everywhere"/>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<!--specify the named cache for session data-->
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="sample-cache" dataCacheClientName="VirtualCache"/>
</providers>
</sessionState>
</system.web>
<dataCacheClients>
<dataCacheClient name="serverCache">
<localCache isEnabled="false" sync="NotificationBased" objectCount="100000"/>
<clientNotification pollInterval="5"/>
<!--cache host(s)-->
<hosts>
<host name="!@13452662.gf.com" cachePort="22233"/>
<host name="!@13452663.gf.com" cachePort="22233"/>
</hosts>
<securityProperties mode="None" protectionLevel="None" />
<transportProperties maxBufferPoolSize="2147483647" maxBufferSize="2147483647" channelInitializationTimeout="60000" receiveTimeout="900000"/>
</dataCacheClient>
<dataCacheClient name="VirtualCache">
<localCache isEnabled="false" sync="NotificationBased" objectCount="100000"/>
<clientNotification pollInterval="5"/>
<hosts>
<host name="localhost" cachePort="22233"/>
<host name="localhost" cachePort="22234"/>
<host name="localhost" cachePort="22235"/>
<host name="localhost" cachePort="22236"/>
</hosts>
</dataCacheClient>
</dataCacheClients>
</configuration>
编辑 :
更改dataCacheClient
为dataCacheClients
导致此错误:
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Web configuration error. Check your Web.config file, or revert to the last working version.dataCacheClientName
Source Error:
Line 31: <providers>
Line 32: <!--specify the named cache for session data-->
Line 33: <add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="sample-cache" dataCacheClientName="VirtualCache"/>
Line 34: </providers>
Line 35: </sessionState>