我有一个网络场,其中包含 4 个托管 Web 应用程序 (x) 的 Web 服务器,它由网络负载平衡器控制,用于我用作App fabric cache
会话提供者的分布式会话维护。
我只使用一个创建了区域的缓存服务器。
我的配置包含区域名称和共享应用程序 ID,这在整个场中托管的所有 Web 应用程序 (x) 中都是相同的。
但是我看看我是否使用 IP 访问网络应用程序所有会话都不同
http://10.10.10.1/myapp/file.aspx returns different session values
http://10.10.10.2/myapp/file.aspx returns different session values
http://10.10.10.3/myapp/file.aspx returns different session values
http://10.10.10.4/myapp/file.aspx returns different session values
http://servername/myapp/file.aspx returns different session values
在这种情况下 sharedId 有什么用?我的目的是维护一个会话,尽管我的应用程序托管在多个服务器中以提高性能。
主要问题是我的缓存行为不正常,有时会话值在更改后 1-2 分钟都没有更新
我的 web.config 设置
<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"/>
<dataCacheClient>
<!-- cache host(s) -->
<hosts>
<host name="x" cachePort="22233" />
</hosts>
<securityProperties mode="None" protectionLevel="None" />
</dataCacheClient>
<sessionState mode="Custom" customProvider="AppFabricCacheSessionStoreProvider">
<providers>
<add name="AppFabricCacheSessionStoreProvider" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider" cacheName="xyz" sharedId="app123" />
</providers>
</sessionState>