Reputation: 191
I have a web site which I developed using C# and Visual Studio.
I noticed that in debug mode in visual studio(but with no break points) when I am on a page and pressing many times F5 to refresh the page, it takes a long time to serve all the requests till I get the last response to the browser. Meanwhile, when trying to access the site from a different browser session, I am waiting for a response from the server which is busy and doesn't respond.
Doesn't IIS work asynchronously when serving requests to clients?
Upvotes: 0
Views: 1736
Reputation: 39500
Yes, IIS can serve multiple requests to clients in parallel, but if you are using session state in ASP.NET, then by default requests from a single session will be served sequentially (so that there's no possibility of two threads accessing the session state at the same time).
Your question is not clear if 'debug mode' means "with a debugger attached to the web server" or "when I compile my application with the 'debug' options" - if it's the former, then all bets are off as far as parallel operation is concerned - attaching a debugger almost always changes threading behaviour.
Upvotes: 6
Reputation: 1062650
IIS and ASP.NET are heavily concurrent. Whether it runs requests from a single client concurrently is up to IIS etc. However, it isn't always possible to detect a disconnect - so if each request hammers the server, it could take a while to finish. The tip there is: don't write slow pages. Set a target time that you want to respond within, and use a tool like mini-profiler to check how you are doing, and what is taking the time. Our target internally is about 30ms, but most folk will probably want to aim for 1s initially, then 0.5s, etc.
Upvotes: 2
Reputation: 6932
When you are debugging and stopped at a breakpoint, all threads are frozen. Thus the other requests are queued up and waiting to be processed.
Upvotes: 1