Wednesday 24 February 2010

IIS 7.0 not serving CSS files

After a rebuild of IIS 7, I couldn't get any CSS files to return. If I browsed to the path http://localhost/styles.css, I would a blank page (even when I view source). The problem was that during the reinstall of IIS I forgot to add the Static Content Component.

For Vista and Windows 7:
Control Panel -> Programs -> Turn Windows features on or off

Then navigate to: Internet Information Services -> World Wide Web Services -> Common HTTP Features
Enable the Static Content option

4 comments:

Anonymous said...

Cheers mate!
Helped me, I was pulling my hair at this...

Simon Stewart said...

I owe you a beer next time you're in South Africa.

Thanks!

Plamen Kasabov said...

Cool. That worked. I tried with Windows Server 2008R2 - had to go to Server Management -> Roles -> Web Server -> Add Roles.

Thanks!

Paul said...

Thanks! I was losing my mind on this one. I wonder why this isn't enabled by default...