4

I have an ASP.NET site running in IIS that I've noticed seems to run slow if one page is slow, so I set up a test to see if it was running as if it was a single thread (i.e. if one page request is running, all others must wait). I created a very simple page (no master page, only has the default aspx code except I added a Literal to dump debug code into) with code to read the current time, sleep 10 seconds, and then exit, like so:

protected void Page_Load(object sender, EventArgs e)
{
    DateTime now = DateTime.Now;
    System.Threading.Thread.Sleep(10000);         
    Literal1.Text = now.ToShortDateString() + " " + now.ToShortTimeString() + " " + now.Second + ":" + now.Millisecond;
}

I then open the page in two different tabs at the same time. The timestamp on each tab is almost exactly 10 seconds apart, which seems to me to mean that the second page request is blocked and waits until the first one completes before running.

I tried commenting out all http modules in web.config and disabling all code in Global.asax, but I still see this issue.

datadamnation
  • 1,802
  • 3
  • 16
  • 17
  • 1
    Which version of IIS are you using? You might want to make sure server side debugging isn't turned on as explained here: http://stackoverflow.com/questions/587420/iis7-only-serves-up-one-page-at-a-time-its-a-making-me-crazy – itsme86 Jun 10 '14 at 19:15
  • Try to disable Session state. There might be session locking. Does it make a difference to try different browsers. – TGH Jun 10 '14 at 19:16
  • You're not trying this with the development server, right? Because that server might be single threaded but IIS is not. – Alex Jun 10 '14 at 19:18
  • 1
    Did you try with two different web browsers instead of tabs? your BROWSWER might share the connection and therefore wait for the response before sending the next request. – jgauffin Jun 10 '14 at 19:18
  • Alex, I am using Visual Studio but the project is set up to use IIS, not the built-in web server. – datadamnation Jun 10 '14 at 19:21
  • jgauffin, I tried different browser windows, no improvement. However, when I tried one IE window and one Chrome window, both loaded at the same time. – datadamnation Jun 10 '14 at 19:24

1 Answers1

10

This sounds like a session state issue.

Access to ASP.NET session state is exclusive per session, which means that if two different users make concurrent requests, access to each separate session is granted concurrently. However, if two concurrent requests are made for the same session (by using the same SessionID value), the first request gets exclusive access to the session information. The second request executes only after the first request is finished. [...]

Source: ASP.Net Session State Overview

Try disabling session state in web.config (or mark it as readonly) to confirm that this is indeed the issue, or use two different browsers (which gets different sessions).

sisve
  • 19,501
  • 3
  • 53
  • 95