2013-11-28 47 views
1

我想配置我的visual studio 2013 asp.net mvc應用程序使用ncache提供程序的會話狀態。配置ncache asp.net sessionstate提供商

到目前爲止,我還增加了一個項目引用Alachisoft.NCache.SessionStoreProvider和Alachisoft.NCache.Web

我也跟着步驟得到here,包括有關的web.config點9,現在有以下系統在我的web.config

<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> 

名.web部分然而,當我調試我的應用程序仍然似乎是使用默認的進程內會話狀態爲一切工作正常,但我的緩存顯示0對象的數量。

使用NCache api我可以將項目添加到緩存中,這很好,它顯示在我的NCache管理控制檯統計信息中。

任何人都可以描述他們如何設置或看到我失蹤的任何東西嗎?在此先感謝

回答

0

我通過實現解決我的問題,我需要添加模式=「自定義」customProvider =「XXXX」屬性在web配置的的sessionState標籤。它在我添加這些時起作用。

我的工作網絡配置現在包括

<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> 

當我添加到我的會話狀態,現在我可以看到1個對象添加到我的nCache緩存。

+0

Alachisoft現在似乎已經更新了他們的文檔,它顯示了http://www.alachisoft.com/resources/docs/ncache/help-4-1/gettingstarted-guide-net.html所需的正確配置 –