net站点:用户的长加载页面将所有其他页面加载放置在等待用户

时间:2022-12-06 08:57:52

I have the following scenario (Asp.net 3.5, Windows Server 2008 R2, IIS7):

我有如下场景(Asp.net 3.5, Windows Server 2008 R2, IIS7):

  • User1 logs into abc.com using Firefox, and goes to a page that takes several minutes to load.
  • User1使用Firefox登录abc.com,并进入一个需要几分钟加载的页面。
  • While that page is loading, User1 cannot load any other pages on the site.
  • 当该页面正在加载时,User1无法加载站点上的任何其他页面。
  • All other page request on the site for User1 with this browser do not receive a response until the first page either finishes loading or times out (then the other requests are completed in quick succession).
  • 在第一个页面完成加载或超时(然后其他请求将快速连续完成)之前,该浏览器对User1站点的所有其他页面请求都不会收到响应。
  • While the first page is still loading (and other requests are on hold) if I open up a different browser (Chrome, though could just as easily be IE) and log on to the site with the same user, I have no problem loading page.
  • 虽然第一个页面仍在加载(其他请求暂停),但如果我打开另一个浏览器(Chrome,尽管也可以是IE),并与相同的用户登录到该站点,那么加载页面就没有问题。

So it seems that the one individual user session is only able to handle a single request at a time (since the same user logging in with a different browser is really a different session to ASP.net).

因此,似乎一个单独的用户会话一次只能处理一个请求(因为同一个用户用不同的浏览器登录,实际上是ASP.net的不同会话)。

What I would like to happen is that while the long-loading request for User1 is loading, that User1 is able to load other pages on the site (in the same browser).

我希望发生的是,当User1的长加载请求正在加载时,User1能够加载站点上的其他页面(在相同的浏览器中)。

Monitoring the server, there are no memory issues (none for Sql Server either). I am doing this while I am the only person using the site. Site is ASP.net 3.5, using Forms authentication. Only non-standard setup detail is that ViewState is being stored in Session.

监视服务器,没有内存问题(Sql server也没有内存问题)。我这样做的时候,我是唯一一个使用这个网站的人。网站是ASP.net 3.5,使用表单验证。只有非标准的设置细节是ViewState被存储在会话中。

In my searching so far, I have not been able to find anything relating to this. If this is the expected behavior, how can I override it? If this is not the expected behavior, what could be causing it, and how can I fix it?

到目前为止,我还没有找到任何与此有关的资料。如果这是预期的行为,我如何重写它?如果这不是预期的行为,可能是什么导致了这种行为,我该如何修复呢?

1 个解决方案

#1


3  

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.

这种行为是故意的;不允许并发访问会话状态。具有相同essionid的请求将被锁定,以防止其状态的潜在破坏。

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

要绕过这个问题,可以在页面指令中禁用会话状态。

<%@Page EnableSessionState="false"/>

Read "Concurrent Requests and Session State" here http://msdn.microsoft.com/en-us/library/ms178581.aspx for more.

更多信息,请阅读http://msdn.microsoft.com/en-us/library/ms178581.aspx中的“并发请求和会话状态”。

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).

设置EnableSessionState=“ReadOnly”将阻止该页面获得对SessionState的独占锁(但是页面本身必须等待用户的其他非ReadOnly请求在加载之前完成)。

#1


3  

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.

这种行为是故意的;不允许并发访问会话状态。具有相同essionid的请求将被锁定,以防止其状态的潜在破坏。

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

要绕过这个问题,可以在页面指令中禁用会话状态。

<%@Page EnableSessionState="false"/>

Read "Concurrent Requests and Session State" here http://msdn.microsoft.com/en-us/library/ms178581.aspx for more.

更多信息,请阅读http://msdn.microsoft.com/en-us/library/ms178581.aspx中的“并发请求和会话状态”。

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).

设置EnableSessionState=“ReadOnly”将阻止该页面获得对SessionState的独占锁(但是页面本身必须等待用户的其他非ReadOnly请求在加载之前完成)。