There is an IIS 7.5 freshly installed on a dedicated server. ASP.NET 4.0 Web app copied to its folder, new website is created on its own IP on post 80, IIS_IUSR and IUSR accounts have read/execute rights on site's folder, the site is assigned to its own Integrated app pool with 4.0 .NET (I tried Classic pool with the same results).

The problem: when I try to access this web site, browser only loads content generated by .NET resources such as aspx pages, .axd files, etc. Static images, static js, css and html files are in the page source but IIS doesn't serve them. Dev tools in all browsers complain that all those static resources have been sent by the server with wrong content type (plain text instead of image, styles, etc). What do I do wrong?

migrated from stackoverflow.com May 19 '11 at 14:27

This question came from our site for professional and enthusiast programmers.

  • What do you see in Fiddler (or Firebug)? – SLaks May 19 '11 at 0:46
  • If its this possible run the page on server, especial run alone the static content on server and you get fully detailed error report. – Aristos May 19 '11 at 0:53
  • I don't use Firebug. But Chrome, for instance, complains "Resource interpreted as Image but transferred with MIME type text/plain" about a jpg file on the page. The same for all styles, js and static html pages. Also, dynamic loads of scripts and html doesn't work. – Kizz May 19 '11 at 0:55
  • @ Aristos: I did that. Server's browser renders the page the same way the external browsers do. No errors, just incomplete page. – Kizz May 19 '11 at 0:57
  • Does the user running the web server has right to read those files ? – Luc M May 19 '11 at 1:29

IIS 7/7.5 has a new "feature" - Role Services. The post from rsbarro reminded me that there is one role service that is responsible for static content. It's Web Server/Common HTTP Features/Static Content. Check if MIME Types icon is present in IIS Manager, as rsbarro suggested.

You need to install the Static Content role service if it does not. To do that, select the:

  • Server Manager
  • Roles
  • Web Server (IIS) node from the left pane
  • scroll to Role Services window
  • see if the Static Content role service is installed.

From what you describe, this seems to be your problem.

In general, if IIS7 doesn't do something that IIS6 did, the first thing to check is to see if the correspondent role service is installed. Hope this helps.

  • Static Content role, how did I miss that? Thanks, fixed the problem perfectly. – David Thomas Garcia Dec 9 '11 at 17:16

Under IIS, go to your web site and check the MIME Types section (see image below). Make sure you see entries in that list for .js, .css, .html, etc, and that they have the proper MIME type specified. IIS 7.5 will only serve up pages if there is a MIME type specified. By default, the MIME types for these extensions are setup in the applicationHost.config file located in C:\Windows\system32\inetsrv\config folder (you may have to run notepad as an Administrator to view the file). Just search for .js and you should find an entry under <mimeMap> in the <staticContent> element.

iis mime types

These settings can be overriden in your web.config file. If they are they will appear in the following location in the web.config:

        <remove fileExtension=".js" />

I would definitely start by checking there. If everything looks ok under the MIME types section, then it's possible you have a module that is interfering with the requests for static files (but most likely only if you have <modules runAllManagedModulesForAllRequests="true" /> set in your <system.webServer> section). If that's the case I would remove all modules setup in your web.config and see if you can bring up the static files, and then readd them one at a time to see which module is causing the problem. If you can't figure it out then I would suggest posting the contents of your web.config (or at least the system.web and system.webServer sections) in the question.


I had the same issue, but my app pool was running under a domain account and that user had rights to the website folder. My website rendered aspx but no static content. What resolved my issue was to add the IIS_IUSRS group to the local security policy called "impersonate a client after authentication'". IIS_IUSRS group had my domain account in it. I am running iis 7.5 windows 2008 server.

  • Wish I could upvote more than once. I came to this question while searching for why my .css files were not being served by IIS. It was related to Windows permissions on the folders where they were stored. – 2b77bee6-5445-4c77-b1eb-4df3e5 Mar 19 at 20:12
  • Thanks, much appreciated! – parttimeadjunct Mar 20 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.