我正在尝试将我的visual 2013 asp.net mvc应用程序配置为会话状态的ncache提供程序。
到目前为止,我已经向Alachisoft.NCache.SessionStoreProvider和Alachisoft.NCache.Web添加了一个项目引用。
我还遵循了找到这里的步骤,包括关于web.config的第9点,现在在web.config中有了下面的system.web部分
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" >
<assemblies>
<add assembly="Alachisoft.NCache.SessionStoreProvider,Version=4.1.0.0,Culture=neutral,PublicKeyToken=CFF5926ED6A53769"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
<sessionState cookieless="false" >
<providers>
<add name="NCacheSessionProvider"
type="Alachisoft.NCacheExpress.Web.SessionState.NSessionStoreProvider"
sessionAppId="NCacheTest"
cacheName="MyClusterCache"
writeExceptionsToEventLog="false"
enableLogs="false"/>
</providers>
</sessionState>
</system.web>然而,当我调试我的应用程序时,它似乎仍然在使用默认的inproc会话状态,因为一切正常,但是我的缓存显示了0对象的计数。
使用NCache api,我可以将项添加到缓存中,这将显示在我的NCache管理控制台统计信息中。
有人能描述一下他们是如何设置的或者看到了我遗漏的任何东西吗?提前感谢
发布于 2013-11-29 03:41:29
我解决了我的问题,我意识到我需要添加mode=“自定义”和sessionState属性到web配置中。我加这些的时候起作用了。
我的工作Web配置现在包括
<system.web>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" >
<assemblies>
<add assembly="Alachisoft.NCache.SessionStoreProvider,Version=4.1.0.0,Culture=neutral,PublicKeyToken=CFF5926ED6A53769"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5" />
<sessionState mode="Custom" customProvider="NCacheSessionProvider" cookieless="false" >
<providers>
<add name="NCacheSessionProvider"
type="Alachisoft.NCache.Web.SessionState.NSessionStoreProvider"
sessionAppId="NCacheTest"
cacheName="MyClusterCache"
writeExceptionsToEventLog="false"
enableLogs="false"/>
</providers>
</sessionState>
</system.web>当我添加到我的会话状态时,我现在可以看到一个对象被添加到我的NCache缓存中。
https://stackoverflow.com/questions/20258220
复制相似问题