Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In IIS7 we can tell a module to run for managed content (thus speeding up static content serving) by:

    <add name="WhateverName"

But. This works fine and dandy as long as there's also a file name (with extension) in the requested URL. If it's omitted it IIS7 will think you want static content and managed modules won't run.

http://localhost/ <-- this one will skip managed handlers
http://localhost/default.aspx <-- this one will run them

If I manually set IIS7 default document, so the first one will be default.aspx, I can see no difference. To me this looks, walks and sounds like a bug. And it is a bug! Why? Because when I request for the first one, it is a managed request, isn't it. Of course it is. But IIS7 treats it as a static request. So? It's a bug. This request should be treated as managed.

How can I convince IIS7 to run managed handlers for URL requests without file names inside?

Help with thinking

Let me help you a bit with thinking: If I'd reorder system.webServer/handlers, I'm sure could solve this. Before the last StaticFile handler that points to StaticFileModule, DefaultDocumentModule and DirectoryBrowsingModule I should be running integrated handler on Directory requests. Or write my own handler, that would append default document to any directory request. I'm pretty sure one of these should solve it. But how would I have to configure/develop it?

share|improve this question

This is not a bug - it is how the managed handler pre-condition works. It makes it so that the module will only be processed by pages that have a managed handler defined for them.

You can take the pre-condition off, and then it will parse everything - but then you lose the performance gains of not parsing your static content.

Your best bet is probably to have all of your static content in a separate directory, and use web.config to remove the module.

share|improve this answer
Is this StaticFile handler (or maybe module) behaviour? What about UrlRewriting that runs before it? – Robert Koritnik Aug 12 '09 at 19:26
I don't think it has anything to do with the handler itself - it is because you are putting the precondition on adding your module. Not sure what would happen if you did a URLRewrite on it. – MattB Aug 12 '09 at 21:36
It is a bug. If I request a path without filename at the end, DefaultDocument presence should determine whether it's a managed or static request. It shouldn't be just static... – Robert Koritnik Sep 2 '09 at 8:16
up vote 0 down vote accepted

This is the actual solution, that solves this managed request bug
Answer on

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.