按照说明,我正在创建一个新问题,而不是在同一篇文章中添加信息: Session timeout is not sliding in Azure Redis Cache Session State Provider
我也有这个问题,觉得我还有其他信息要做出贡献。我无法添加评论(它说我没有足够的声誉),所以我试图发布一个回复,它被删除了,因为它不是一个答案,并被指示提出一个新问题,所以在这里。< / p>
我在另一篇文章中看到,Siddharth Chatrola要求有这个问题的人提供他们的配置和记录信息。
请注意,我们的应用程序是Asp.Net Mvc'单页应用程序',因此我们使用ajax请求将内容加载到div中,我想知道这是否是不能可靠地调用ResetItemTimeout的原因。
缓存失败导致我们的用户被注销。我们设置了200分钟的超时时间,这有所帮助,但我们确实需要这个才能正常工作。使用Azure云服务体系结构的价值在于它是可伸缩的,但如果在有多个实例时无法可靠地维护会话,则该值将丢失。
我使用的是1.6.4版本。 这是我们的配置:
<sessionState mode="Custom" customProvider="MySessionStateStore" timeout="200">
<providers>
<add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider"
host="focuscache.redis.cache.windows.net"
accessKey="xxxx"
port="6380"
ssl="true"
applicationName="Esurety"
loggingClassName = "Esurety.Core.Utility.StringUtilities, Esurety.Core, Version=6.0.9.3, Culture=neutral, PublicKeyToken=null"
loggingMethodName = "GetLogger"
/>
</providers>
</sessionState>
我启用了日志记录,我可以看到ResetItemTimeout大多数时间都没有被调用:
[2015-07-30 16:00:04.591][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:00:04.622][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738688045914548
[2015-07-30 16:00:04.947][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738688045914548.
[2015-07-30 16:00:05.094][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:00:05.116][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738688050941381
[2015-07-30 16:00:05.698][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738688050941381.
[2015-07-30 16:00:10.301][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:00:10.316][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738688103013334
[2015-07-30 16:00:10.619][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738688103013334.
[2015-07-30 16:00:10.796][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:00:10.820][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738688107968188
[2015-07-30 16:00:11.992][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738688107968188.
[2015-07-30 16:03:29.088][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:03:29.119][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738690090883595
[2015-07-30 16:03:37.776][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738690090883595.
[2015-07-30 16:06:15.967][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:15.983][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691759679369
[2015-07-30 16:06:16.935][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691759679369.
[2015-07-30 16:06:23.869][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:23.895][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691838698966
[2015-07-30 16:06:24.130][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691838698966.
[2015-07-30 16:06:24.319][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:24.351][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691843199332
[2015-07-30 16:06:24.703][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691843199332.
[2015-07-30 16:06:26.951][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:26.962][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691869519009
[2015-07-30 16:06:27.408][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691869519009.
[2015-07-30 16:06:27.561][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:27.576][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691875611489
[2015-07-30 16:06:28.121][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691875611489.
[2015-07-30 16:06:31.225][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:31.256][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691912250593
[2015-07-30 16:06:31.632][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691912250593.
[2015-07-30 16:06:31.821][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:31.838][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691918218208
[2015-07-30 16:06:32.294][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691918218208.
[2015-07-30 16:06:34.764][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:06:34.779][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738691947640393
[2015-07-30 16:06:35.296][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738691947640393.
[2015-07-30 16:07:57.461][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:07:57.493][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738692774614613
[2015-07-30 16:07:58.103][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738692774614613.
[2015-07-30 16:08:08.723][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:08:08.754][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738692887232898
[2015-07-30 16:08:15.001][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738692887232898.
[2015-07-30 16:08:21.752][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:08:21.767][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738693017522310
[2015-07-30 16:08:22.035][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738693017522310.
[2015-07-30 16:08:25.652][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:08:25.683][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738693056520881
[2015-07-30 16:08:27.330][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738693056520881.
[2015-07-30 16:08:27.535][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:08:27.550][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738693075350154
[2015-07-30 16:08:28.555][Info]ReleaseItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => For lockId: 635738693075350154.
[2015-07-30 16:08:53.456][Info]GetItemExclusive => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602.
[2015-07-30 16:08:53.472][Info]GetItemFromSessionStore => Session Id: xw5nbfaiktejo5rinhbdrvjm, Session provider object: 49331602 => Lock taken with lockId: 635738693334565328
如果有人能提供在Asp.Net MVC SPA上触发ResetItemTimeout的方法,我将不胜感激。我已经sublcassed Controller类,所以我可以轻松地添加一些可以重置计时器的OnActionExecuting或OnActionExecuted。
非常感谢您的帮助, 丹尼格林
答案 0 :(得分:0)
感谢您报告此问题。 ASP.NET没有为AJAX请求调用ResetItemTimeout,并且其他会话状态方法负责滑动会话超时。我们修复了这个bug并发布了一个新的NuGet包:https://www.nuget.org/packages/Microsoft.Web.RedisSessionStateProvider/1.6.5
让我们知道这是否可以解决您的问题?