IIS 7.5 doesn't load static html pages

3,084

Solution 1

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.

Solution 2

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.

Solution 3

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:
3,084

Related videos on Youtube

Reena
Author by

Reena

Updated on September 18, 2022

Comments

  • Reena
    Reena over 1 year

    I am able to change the my date Format 2014-12-09 to MMM dd,yyyy(Dec 09,2014 Like this.) But It Display Jan 09,2014 instead of Dec 09,2014. How to display Dec 09,2014? Please Guide me.

    My Code is,

    String strStartDate = "2014-12-09";
    
                readFormat = new SimpleDateFormat("yyyy-mm-dd");
                writeFormat = new SimpleDateFormat("MMM dd,yyyy");
    
                try {
                    startDate = readFormat.parse(strStartDate);
                } catch (ParseException e) {
                    e.printStackTrace();
                }
    
                viewHolder.txtStartDate
                        .setText(writeFormat.format(startDate));
    

    Thanks in advance.

    • SLaks
      SLaks almost 13 years
      What do you see in Fiddler (or Firebug)?
    • Aristos
      Aristos almost 13 years
      If its this possible run the page on server, especial run alone the static content on server and you get fully detailed error report.
    • Admin
      Admin almost 13 years
      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.
    • Admin
      Admin almost 13 years
      @ Aristos: I did that. Server's browser renders the page the same way the external browsers do. No errors, just incomplete page.
    • Luc M
      Luc M almost 13 years
      Does the user running the web server has right to read those files ?
    • Admin
      Admin almost 13 years
      IIS_IUSR and IUSR both have read/execute rights on the main folder of the site
    • Aristos
      Aristos almost 13 years
      @Kizz place on url the specific resource that you not load on page to see the error, not the full page, but copy/paste the image that you can not load. This way, iside the server iis gives you detail about the error. On Chrome, open the inspection and view the Network Tab. For me probably is security issue, or if you have made a plesk copy, then a bad iis configuration. On bad iis configuration there is a reset for the http response filter button on the iis.
    • Yugesh
      Yugesh over 9 years
      use simple date format to change the date format.
    • Mohammed Ali
      Mohammed Ali over 9 years
      see this link: stackoverflow.com/q/27023189/3879470. @Reena do you have time in milliseconds.? Use SimpleDateFormat sdfDate = new SimpleDateFormat("MMM d, yyyy")
    • Reena
      Reena over 9 years
      @Yugesh Have you any demo then send me.
  • David Thomas Garcia
    David Thomas Garcia over 12 years
    Static Content role, how did I miss that? Thanks, fixed the problem perfectly.
  • Reena
    Reena over 9 years
    I am Using your code but It display Dec 11,2014 Instead of Nov 11,2014. How to display Nov 11, 2014 Instead of Dec 11,2014. Because My current date is 2014-11-26 not a 2014-12-26. Its increment one month.
  • Reena
    Reena over 9 years
    I am Using your code but It display Dec 11,2014 Instead of Nov 11,2014. How to display Nov 11, 2014 Instead of Dec 11,2014. Because My current date is 2014-11-26 not a 2014-12-26. Its increment one month.How to Display Nov 11,2014. Please Reply me.
  • Reena
    Reena over 9 years
    @Pratt I am Using your code but It display Dec 11,2014 Instead of Nov 11,2014. How to display Nov 11, 2014 Instead of Dec 11,2014. Because My current date is 2014-11-26 not a 2014-12-26. Its increment one month.
  • Don Chakkappan
    Don Chakkappan about 7 years
    change new SimpleDateFormat("yyyy-mm-dd"); to new SimpleDateFormat("yyyy-MM-dd");
  • 2b77bee6-5445-4c77-b1eb-4df3e5
    2b77bee6-5445-4c77-b1eb-4df3e5 about 5 years
    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.