سؤال

I wrote a test page that does a bunch of busy work in a method called at page load. This process as I have it now takes around 12 seconds.

If I try to load another page while the first long running page is loading, this second page doing nothing except writing out a hello world, it doesn't load until the first long running page is finished.

Why is this the case? I would think IIS would be able to handle multiple concurrent connections, it seems crazy that one long running page would stop every other page in the application from loading. I must be missing something or not understand how IIS works.

I would think multiple independent requests would be spawned on different threads. Is this only the case if the requests are from different sessions entirely? Are all requests from a single session bound to a single thread?

bd

هل كانت مفيدة؟

المحلول

You need to turn off sessionState... if session is on, any sub-sequent request is waiting on the previous thread to finish in order to continue on that particular session.

So turn session off, it will not need to wait for any previous session.

in web.config put

<system.web>
    <sessionState mode="Off" />
</system.web>

Now you should have those request process concurrently.

نصائح أخرى

I just hit this issue too, and for me it turns out it is the session feature of ASP.NET. Basically if you have sessions enabled, each request will return in the order it arrived per user.

Try using 2 different browsers, for me it no longer blocked. Here is a similar question:

IIS 5.1 on XP Classic ASP appears to be in single threaded mode

It's a threading problem. While IIS can handle multiple connections simultaneously, ASP.NET, by default, is configured in single-threaded mode.

This choice by Microsoft was to prevent dummy developers to make common concurrency mistakes. ASP.NET for Mono doesn't show this behaviour and if you access shared resources without prior locking you might be... f... you know ;) by a yellow page of death.

I don't remember the exact procedure, but in the properties of your website you can choose the application pool and also the number of threads. I saw with my eyes that IIS6 sets it to 1 by default.

If you can't find it, tell me and tomorrow I'll take a look on my development server in lab.

Hope to have been of help.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top