CSS Not Loading When Hosting in IIS

I ran into a problem recently that I had not encountered before.  On a fairly new dev laptop, where I use mostly use Cassini and IIS Express for development, I had need to deploy a site to IIS.  I have IIS 7 on my machine.

When I ran the site being hosted in IIS, my CSS was obviously being ignored by something, somewhere.  The CSS wasn’t rendering the page weird—I mean it wouldn’t render at all.  Although it worked with the same site when I ran it from Visual Studio.

Long story short, after some digging and help from a friend, I realized this was due to one little checkbox that I failed to check when turning on the IIS features on my laptop: STATIC CONTENT—under the Common HTTP Features section.


Without this, many MIME types will not be recognized by IIS—including CSS files being mapped to the “text\css” MIME type.  Which leads to another interesting point: You’ll notice that the MIME Types icon is missing from the Features View of IIS if Static Content is not turned on (generally between Logging and Modules).


Hope this saves you some time and a headache!  BTW—I was fortunate enough to discover this problem during a presentation.  Confused smile