IIS hangs the first time two requests are made for same page quick

G

Guest

It appears that IIS hangs the first time two requests are made for same page
in quick succession. Although it may very well be something else I'm doing
wrong.

I have a page (ViewDocument.aspx) that dynamically generates one or more
image tags. The source attribute of the image tag is another page
(ViewImage.aspx) that simply writes the image data to the response.

When I load ViewDocument.aspx for the first time, everything is fine as long
as it only generates one image tag. I can load it again, generating multiple
image tags, and everything is solid.

However if when I load ViewDocument.aspx the first time, and cause it to
generate multiple image tags, IIS hangs (actually needs to be restarted).

When the error occurs, I see that the ViewImage.aspx constructor is called
twice, but that the Page_Load is never called.

Is it possible that the first request is causing the ViewImage.aspx page to
be compiled and if the second request for that page comes before it's
finished being compiled that the whole thing goes off into the weeds?

Thanks,
Brad
 
M

Mike Newton

HTTP requests usually work in that you don't get a response until you
get a response... meaning that if I send a request to IIS for a page,
IIS makes me wait until it is done processing the page. I wait for
compilation to complete before I get a response.

If I have another request that happens simulatneously, it waits in a
queue until a response can be given.


Do you use a file stream to open an image file? If you do, that may be
where the problem is, depending on which value of the FileShare
enumeration you use. You open the file, which locks the file, and it
won't be released until the stream is closed... which if not done in
code, is done when the garbage collector annihilates the page.
 
G

Guest

Thanks Mike, you got me pointed in the right direction.

It turned out that the page I was deriving from implements IHttpAsyncHandler
and uses a custom thread pool (actually I think it's based on Mike
Woodring's).

Telling the page to process synchronously was enough to fix the problem (but
makes me wonder where else I might have problems).

Thanks again,
Brad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top