Wednesday, 4 August 2010

Fix - IIS 7.0 and 7.5 Not Rendering CSS Files or other static content with Error 500 or Blank Pages

During a deployment for a client today of a custom ASP.NET application, IIS 7 refused to render external css files correctly - just spitting out Error 500 or blank content.  This happens because IIS 7 and 7.5 do NOT render static content by default - which is a little surprising but not completely unexpected.

To fix for Windows Server 2008:
  1. Open up Start - Administrative Tools - Server Manager on the Front End web server in question.
  2. Select Web Server (IIS) under Roles
  3. Click on "Add Role Services"
  4. Enable the "Static Content" checkbox.
  5. In IIS 7, Click on the Website and double click Handler Mappings
  6. Right click on "StaticFile" and click "Edit" .
  7. In the Module Field add "StaticFileModule,DefaultDocumentModule" and click OK
  8. DONE - FIXED!
The official support document for this on the MS site can be found here:
http://support.microsoft.com/kb/2196177

DDK