IIS7 returns blank when static content requested
Did you turn on the static content feature?
As @MattB suggested, I havn't had the "Static Content" feature enabled, but that is only one part of the problem.
I've added the "Static Content" feature and yet the problem still persist, so I go about removing the default MvcHttpHandler from the handler mappings list and somehow the problem solves itself... so the problem was that MvcHttpHandler was intercepting requests before the StaticFileHandler,
FYI, after installing the "Static Content", also make sure that...
- In the Internet Information Services Manager, click your website.
- Double-click on the "Handler Mappings" feature.
- On the right-hand side (the Action panel) you will see a link titled "View Ordered List..." , click it.
- You will then find the order the module are matched to each requests, make sure that the order make sense.
In my case MvcHttpHandler was above everything else, I solved the problem by moving it to the bottom of the list, which is the most sensible place it ought to be in because AXD file handlers, TRACE handlers, OPTIONS handler and static content gets a shot at handling the request first.
Hope this helps someone googling for the same problem :-)
In my case, the server role was already installed, and yet the static handler served blank pages even for a trivial test site with just a single handler mapping.
The fix was to enable the request restriction "Invoke handler only if request is mapped to". It doesn't matter whether I set it to "File" or "File or directory"; as long as the checkbox is enabled, it works:
If this still doesn't help, another thing that leads to blank pages is trying to specify a path in the "Request path" section, like
public or maybe
public/*. The latter is simply wrong, while the former should be accepted, but instead results in blank pages. The solution is to wrap the handler mapping into a
<location path='public'> section, specifying
* for the "Request path" setting. Or, in IIS Manager, expand the site and select your folder first, then edit the handler mappings.