ASP.net会话请求排队 [英] ASP.net session request queuing

查看:1090
本文介绍了ASP.net会话请求排队的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我看来,这ASP.net排队使用相同的会话ID的所有请求。比方说,你已经有了3页。

It seems to me that ASP.net queues up all requests that use the same Session ID. Let's say you've got 3 pages.

Default.aspx的

Default.aspx

protected void Page_Load(object sender, EventArgs e)
{
    Session["asdf"] = "LOLZ";
}

达不到这个页面,如果不存在显然会创建一个新的会话。

Hitting this page would obviously create a new session if one doesn't exist.

X-AspNet-Version: 2.0.50727
Set-Cookie: ASP.NET_SessionId=ibjphuv0aiafqi453tyze345; path=/; HttpOnly

然后你打Hang.aspx

Then you hit Hang.aspx

protected void Page_Load(object sender, EventArgs e)
{
    Thread.Sleep(10000);
}

你打任何其他网页,这个会话ID将被传递到

和后,如果它做任何事情没关系,我们称之为Test.aspx文件。

And immediately after you hit any other page that this session ID would be passed to, doesn't matter if it does anything, let's call it Test.aspx.

加载顺序是像这样。

Request            Timeline
"GET /"            |*|
"GET /Hang.aspx"       |******************************************|
"GET /Test.aspx"            |**************************************|

我想我的问题是我如何禁用此功能。我知道这是非常有用的,这样会话状态可以更predictable,但在我的情况下长时间运行报告页面加载是杀用户多任务的能力。

I guess my question is how do I disable this feature. I understand it's useful to have so that session state can be more predictable, however in my case a long running reports page load is killing users' ability to multitask.

推荐答案

这行为是设计;到会话状态,不会并发访问是允许的。与相同的SessionID请求将被完全锁定其状态的prevent潜在破坏。

This behaviour is by design; no concurrent access to the session state is allowed. Requests with same SessionID will be locked exclusively to prevent potential corruption of its state.

要解决这个问题,你可以在你的page指令禁用会话状态。

To get around this you can disable session state in your page directive.

<%@ Page EnableSessionState="false" %>

阅读并发请求和会话状态在这里 http://msdn.microsoft .COM / EN-US /库/ ms178581.aspx 了解。

设置的EnableSessionState =只读将prevent该网页上SessionState会获得独占锁(但网页本身将不得不等待其他非用户只读请求加载之前完成)。

Setting EnableSessionState="ReadOnly" will prevent that page from gaining an exclusive lock on the SessionState (but the page itself would have to wait for other non-ReadOnly requests by the user to finish before loading).

(这是我回答的复制和粘贴到这个问题,<一个href=\"http://stackoverflow.com/questions/4063012/asp-net-site-long-loading-page-for-user-puts-all-other-page-loads-for-user-on-ho/4063152#4063152\">ASP.net网站:用户长期加载页面将所有其他页面加载用户在保持)

(This is a copy and paste of my answer to this question ASP.net site: Long-loading page for user puts all other page loads for user on Hold)

这篇关于ASP.net会话请求排队的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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