在 ASP.NET MVC3 中使用无会话控制器的场景有哪些?
阅读 Guru-Gu 关于 ASP.NET MVC3 实现 RC 的博客文章,他说:-
无会话控制器支持
您现在可以表明是否想要 使用会话状态的控制器类 – 如果是这样,您是否希望如此 读/写或只读。读/写或只读。
有人可以解释一下在某些情况下有人可能想要一个无会话控制器吗?或者只读控制器?
我一直在创建 单独的 IIS 网站,我用它来处理所有静态图像/内容,然后让同一个网站关闭会话状态 ...因此不会通过网络发送 cookie。这是类似的场景吗?
Reading Guru-Gu's blog post about ASP.NET MVC3 hitting RC, he says:-
Session-less Controller Support
You can now indicate whether you want a
Controller class to use session-state
– and if so whether you want it to be
read/write or readonly.read/write or readonly.
Can someone explain what are some scenario's someone might want to have a session-less controller? or a read-only controller?
I've always been creating a separate IIS website which I use to handle all static images/content and then have this same website have session state turned off ... so no cookies are sent over the wire. Is this a similar scenario?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对此,顾先生发表了评论。引用:
一般来说,这是 ASP.NET 中的已知场景。同一用户的会话对象不是线程安全的。这意味着,如果同一用户(相同的会话 ID cookie)向使用会话的页面发送多个请求,这些请求将排队并按顺序而不是并行处理。
Gu commented about this. Quoting:
This is a known scenario in ASP.NET in general. The session object for the same user is not thread safe. This means that if the same user (same session id cookie) sends multiple requests to a page which uses session those requests will queue and will be processed in series and not in parallel.