IIS7 returns blank when static content requested

Solution 1:

Did you turn on the static content feature?

http://weblogs.asp.net/anasghanem/archive/2008/05/23/don-t-forget-to-check-quot-static-content-service-quot-in-iis7-installation.aspx

enter image description here

Solution 2:

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...

  1. In the Internet Information Services Manager, click your website.
  2. Double-click on the "Handler Mappings" feature.
  3. On the right-hand side (the Action panel) you will see a link titled "View Ordered List..." , click it.
  4. 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 :-)


Solution 3:

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:

                  enter image description here

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.