Browsing to static content returns a blank page or HTTP 500 Server Error message in Internet Information Services (IIS) 7.0 and 7.5


Symptoms


When you browse to a website hosted on Internet Information Services (IIS) 7.0 or 7.5, and the web page content you are browsing to is mapped to the StaticFileHandler in IIS, you may encounter one of the following problems:


1) An error message similar to the following is displayed:

HTTP 500 - Internal Server Error


OR



2) You are presented with a simple blank page in the web browser window. 




Cause


This problem can occur for one of the following reasons:

1) The StaticFileModule is not installed in the current installation of IIS



OR



2) The StaticFileHandler is missing StaticFileModule from its module list. 


Resolution


To resolve this problem, install the Static Content feature of the Common HTTP Features under the Web Server role on the webserver. If the Static Content feature is already installed, then simply edit the StaticFileHandler mappings using the IIS Manager user interface to add StaticFileModule to the module list. 



To install the Static Content feature on Windows Server 2008 and Windows Server 2008 R2, follow these steps:

a. Open Server Manager, and then expand Roles.
b. Right-click Web Server (IIS), and then click Add Role Services.
c. Under Web Server, click to select the "Static Content" check box.
d. Click Next to complete the installation.



To install the Static Content feature on the Windows Vista and Windows 7 client operating systems, follow these steps:

a. Click Start, and then click Control Panel.

b. Double-click Programs and Features.

c. Click Turn Windows features on or off.

Note If you are prompted for an administrator password or for a confirmation, type the password or click Continue. 

d. Expand Internet Information Services --> World Wide Web Services --> Common HTTP Features --> Click the Static Content check box to install, and then click OK.



To edit the StaticFileHandler mappings, follow these steps:

a. Click Start, type Inetmgr in the Start Search box, and then click Inetmgr in the Programs list.

Note If you are prompted for an administrator password or for a confirmation, type the password or click Continue. 

b. In IIS Manager, expand server name, expand Web sites, and then click the web site that you want to modify the settings for.

c. In Features view, double-click Handler Mappings.

d. In the Handler Mappings pane, right-click the StaticFile handler mapping, and then click Edit.

e. In the Edit Module Mapping dialog box, add StaticFileModule in Module box by manually typing it, and then click OK.

Note The default entries in the Module box are StaticFileModule,DefaultDocumentModule,DirectoryListingModule



More Information


The default installation of IIS has a wild card mapping for the StaticFile handler. In another words, any request that does not get handled by a pre-configured handler will eventually be attempted to be served by the StaticFile handler. The StaticFile handler is a special case handler which attempts to load pre-configured modules (StaticFileModule,DefaultDocumentModule,DirectoryListingModule) on it's invocation. 

Consider a scenario where you are trying to browse to a static content page such as a ZIP file. You expect to get an Open/Save dialog box prompt, but instead you get a blank page or an HTTP 500 error. This occurs because there was no pre-configured handler mapping for .ZIP extensions, so it was handled by the StaticFile handler. The StaticFile handler will try and load the StaticFileModule, DefaultDocumentModule, and DirectoryListingModule in that order. If StaticFileModule is missing from the StaticFileHandler entry then the handler will not load this module. Only StaticFileModule understands what to do with a request with a .ZIP extension (by default). Since it is missing from the request processing pipeline then there is nothing to actually process the request, and you will get the HTTP 500 error (provided you have the CustomErrorModule installed, which is responsible for processing all HTTP errors). If you do not have the CustomErrorModule installed, you will see a blank page as the response for this specific .ZIP request.