Phenomenon: In the Web site, open a page time is more serious, and then open another page for login verification, found that multiple HTTP requests do not respond and return values.
On-line information, accidental discovery is due to the session of the lock mechanism.
The original session implemented the Reader/writer lock mechanism:
When the page has a writable function on the session (that is, the page has a <%@ page enablesessionstate= "True"%> tag), this time until the session requesting completion of the page holds a write lock.
When the page has read-only functionality to the session (that is, the page has a <%@ page enablesessionstate= "ReadOnly"%> tag), the session that requested completion of the page holds a read lock.
Read locks block A write lock, read locks do not block read locks, and write locks block all read and write locks. That's why when the same page in both frames goes to the same session, one of them waits for the other (slightly faster) to finish before it starts writing.
Solution:
1. Set session state in Global.asax
public override void Init () {
This. Postauthenticaterequest + = (sender, e) = =
HttpContext.Current.SetSessionStateBehavior (sessionstatebehavior.readonly);
Base. Init ();
}
2. Set session state in a separate page
<%@ page enablesessionstate= "ReadOnly"%>
One of the reasons that ASP. NET MVC request is slow (session affects concurrency)