.Net Core MVC 应用程序中的会话变量随机丢失

发布于 2025-01-18 19:34:49 字数 646 浏览 1 评论 0原文

我们发现,我们的.NET Core 3.1 MVC应用程序中会随机丢失会话变量。行为是我们在会话中使用键序列化并存储一个JSON字符串。对于大多数零件,我们可以毫无问题地检索该值。但是,我们发现有时会丢失同一项目(尤其是最后存储的条目)。没有错误,只是在会话中找不到匹配项。会话丢失时尚未过期,并且我们的代码不包含会话项目的删除。 Apppool也没有回收。

以下是我们在错误时间期间捕获的日志。很奇怪的是,会议装有第6次,突然变成了第5次。有人知道它可能会如何发生吗? .NET核心中的问题吗?

2022-03-31 17:37:00,724 debug microsoft.aspnetcore.distributedsession.logmessage [0] - 消息:会话加载:键:22CEAEB2-802E-FD67-267-215C-3A83FFFCDA2C8,ID ,计数:6

2022-03-31 17:37:06,138 debug microsoft.aspnetcore.distribedsession.logmessage [0] - 消息:会话加载:键:22CEAEB2-802E-FD67-215C-3A83FFCDA2C8,ID:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF:AF: -AAA8-47D28D8BD13,计数:5

谢谢,

We found that a session variable is randomly missing in our .Net Core 3.1 MVC application. The behavior is that we serialized and stored a json string with a key in the session. For most parts, we can retrieve the value with no problem. However, we found that the same item is missing sometimes (particularly last stored entry). No error, just no matching item found in the session. The session has not expired when it's missing and our code doesn't contain removal of the session item. AppPool is not recycled either.

Below are the logs that we captured during the error time. Strange enough that the session is loaded with Count 6 and suddenly become Count 5. Does anyone have a clue how it could happen? Is it a problem within .Net Core?

2022-03-31 17:37:00,724 DEBUG Microsoft.AspNetCore.DistributedSession.LogMessage [0] - MESSAGE: Session loaded: Key:22ceaeb2-802e-fd67-215c-3a83ffcda2c8, Id:af78b774-c675-db5b-aaa8-47d28d8bd13, Count:6

2022-03-31 17:37:06,138 DEBUG Microsoft.AspNetCore.DistributedSession.LogMessage [0] - MESSAGE: Session loaded: Key:22ceaeb2-802e-fd67-215c-3a83ffcda2c8, Id:af78b774-c675-db5b-aaa8-47d28d8bd13, Count:5

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文