Cannot access static content of an ASP.NET MVC app on IIS7

5,053

Based on your comment that you have the static file handler above the MVC hander, it sounds like you have it set correctly.

Just as an extra double check, go to server manager, roles and IIS, make sure that you have necessary features added to IIS. That really just adds it to applicationHost.config, but it serves as a double check. That will ensure that the modules, handlers and globalmodules are installed and enabled.

Share:
5,053

Related videos on Youtube

Jon
Author by

Jon

Updated on September 17, 2022

Comments

  • Jon
    Jon over 1 year

    I have an ASP.NET MVC 2 app that I have just deployed to IIS7. The app works fine except all static content (js, css, images) are returning blank.

    I have the static content handler configured above the MVC handler.

    I have looked in the IIS logs and for the static content a HTTP 302 status is returned, but I still can't see them on my page.

    Any ideas? Anything else I can check or try?

    • Jon
      Jon over 13 years
      I currently have this successfully deployed on IIS6, so I am thinking it must be something in the configuration of IIS7.
  • Jon
    Jon over 13 years
    Thanks, I just checked the features and they are all installed :(
  • Scott Forsyth
    Scott Forsyth over 13 years
    This still seems like the most likely cause for me. How about from Server Manager, removing static pages, applying and then adding it back again. That will refresh the settings. Consider doing that for a number of the settings. In fact, if you don't have any unique settings that you don't mind losing, try a full reinstall. That will give you a fresh applicationHost.config again. Another test is to try a new website with a simple hello world in it. That will confirm if it's server level or something with your site or site configuration.
  • unhappyCrackers1
    unhappyCrackers1 almost 12 years
    The IUSR is the default account for anonymous authentication. You can change that, look here: iis.net/ConfigReference/system.webServer/security/…
  • Roman
    Roman almost 12 years
    Static content handler impersonates IUSR by default, you can set it to the application pool identity by editing the property.