LibrarySites.Banner

Enable IIS Static Content for the Sitecore ASP.NET CMS

This blog post explains how to enable the Static Content feature of Internet Information Services (IIS) to resolve an issue that may cause pages to render incorrectly after installing the Sitecore ASP.NET web Content Management System (CMS).

Sitecore provides a dynamic page engine, but markup generated by that engine may depend on external resources that are relatively static, specifically .js, .css, and various image files.

In order to serve those files, you need to enable the Static Content feature of IIS. Without this feature, your page cannot load JavaScript, CSS, or images. In such cases, the Sitecore login page may look something like the following.

screen capture of Sitecore login page without static resources

Strangely, resources requested seem to return HTTP 200 (OK), where one might expect 404.

screen capture showing HTTP 200 but no content

The file exists and IIS returns HTTP 200, but no content. If the file does not exist, IIS does return 404.

screen capture showing HTTP 404 for static files that do not exist

Images rendered from the media library work; images rendered from the file system do not. The Jetstream demo site home page includes some images from the media library.

screen capture Jetstream home page failing to load static resources

Scroll down to see content without static resources.

screen capture of Jetstream home page without static resources scrolled down to text components

To address this issue, you need to enable the Static Content feature of IIS. First, find Turn Windows features on or off in the Windows Control Panel. Details may vary by operating system.

screen capture of Windows Control Panel showing Turn Windows features on or off

Expand Internet Information Services, then World Wide Web Services, then Common Features, and then enable the Static Content feature.

screen capture of enabling Static Content Windows feature

Now IIS returns HTTP 200 and content.

screen capture of successful request for a static resource

Load the Sitecore login page again.

screen capture of Sitecore login page

The Jetstream home page also looks different.

screen capture showing successful Jetstream home page load

Resources

  • If you have Static Content enabled but still the login page looks without fonts and images, try fixing the issue by removing this line from web.config     <staticContent>       <!--<mimeMap fileExtension=".woff" mimeType="font/x-woff" />-->     </staticContent> The woff mime type might be already set up in your IIS, hence conflicting with Sitecore's attempt to add it in web.config.

  • Hi I have a problem with  when I upgraded my siteocre to 7.5, like when I open Items Statically in Package design i cannot see the sitecore tree or items, i have to change the css with firebug the class scStretch or scStretchAbsolute ( change absolute to relative....) I tried to reinstall sitecore again many times and I have always same problem. When I change the css class (position absolute or relative) some times I cannot click on the button.  Have you idea what s the cause please?

  • @Walid: I have not heard of this on any other systems, but I generally don't go through upgrades. The only ideas that come to mind are something having gone wrong during the upgrade or something caching an old CSS. The latter seems less likely.

  • Thanks, great post. I installed sitecore8.1 in window 10 machine .After installation CSS was not loading @ home page. After following above steps. Its working perfectly fine.