Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

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

3 Answers 3

up vote 7 down vote accepted

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.

share|improve this answer
    
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:

<system.webServer>
    <staticContent>
        <remove fileExtension=".js" />
    </staticContent>
</system.webServer>

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.

share|improve this answer
    
Absolutely worked for me. Thanks so much. –  Nick Dec 3 '11 at 16:11

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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