1

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
  • 11
  • 1
  • 2
  • I currently have this successfully deployed on IIS6, so I am thinking it must be something in the configuration of IIS7. – Jon Dec 15 '10 at 02:04

2 Answers2

1

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.

Scott Forsyth
  • 16,449
  • 3
  • 37
  • 56
  • Thanks, I just checked the features and they are all installed :( – Jon Dec 15 '10 at 02:48
  • 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. – Scott Forsyth Dec 15 '10 at 16:01
0

I found the issue - I should have gone with my first thought when I had it - I ran ProcMon and found that it was getting an Access Denied on my static content directory.

However the user trying to access it was IUSR, NOT NetworkService (as the App Pool is set up to run under). This must be an IIS7 thing?

Jon
  • 11
  • 1
  • 2
  • The IUSR is the default account for anonymous authentication. You can change that, look here: http://www.iis.net/ConfigReference/system.webServer/security/authentication/anonymousAuthentication – unhappyCrackers1 Jun 23 '12 at 12:06
  • Static content handler impersonates IUSR by default, you can set it to the application pool identity by editing the property. – Wyatt Barnett Jun 23 '12 at 14:14