是具有在ASP.NET MVC3无会话控制器的一些情况的呢? [英] What are some scenario's of having a Session-less Controller in ASP.NET MVC3?

查看:253
本文介绍了是具有在ASP.NET MVC3无会话控制器的一些情况的呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读<一href=\"http://weblogs.asp.net/scottgu/archive/2010/11/09/announcing-the-asp-net-mvc-3-release-candidate.aspx\">Guru-Gu's博客文章ASP.NET MVC3打RC ,他说: -

会话少控制器支持

您现在可以指示是否希望
  Controller类使用会话状态
   - 如果是的话,你是否希望它是
  读/写或readonly.read/write或只读。

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?

我一直创建<一个href=\"http://stackoverflow.com/questions/4105149/how-to-respect-serve-static-content-from-a-cookieless-domain-page-speed-rule-in/4105649#4105649\">separate IIS网站,我用它来处理所有静态图像/内容,然后有同样的网站有会话状态关闭 ......所以没有饼干通过网络发送。这是一个类似的情况?

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?

推荐答案

顾评论这件事。引用:

本发行说明包含这更(你
  可以从下载他们
  上面的链接)。会话状态
  设计成使得从只有一个请求
  特定用户/会话发生在
  时间。所以,如果你有一个网页,有
  多个AJAX回调发生在
  一旦他们将在串行处理
  时尚在服务器上。展望
  会话少意味着他们将
  并行执行。

The release notes cover this more (you can download them from the download link above). Session state is designed so that only one request from a particular user/session occurs at a time. So if you have a page that has multiple AJAX callbacks happening at once they will be processed in serial fashion on the server. Going session-less means that they would execute in parallel.

这是普遍在ASP.NET已知的情况。同一用户的会话对象不是线程安全的。这意味着,如果相同的用户(相同的会话cookie)发送多个请求到使用会话的页面这些请求将排队,并将串联,而不是在并行处理。

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.

这篇关于是具有在ASP.NET MVC3无会话控制器的一些情况的呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆