26

I have 2 Windows 2008 R2 x64 servers NLB, ARR with shared configuration. I have the application files in a network share. ASP.net pages (.aspx) come up fine but no css,images,js work. I also have a .htm file shows css and images just fine.

In the iis log I do see a 401.3 message. So it seems to be permissions but not sure what else to configure permissions wise.

I read similiar issues at:

MVC + IIS7 = CSS Issue

https://serverfault.com/questions/70050/adding-a-virtual-directory-iis-7-5-windows-7-ultimate-x64/130322#130322

https://serverfault.com/questions/126978/iis-7-5-401-3-access-denied

I tried the suggested solutions - none seems to work (unless I missed something). Any advice is greatly appreciated!

Community
  • 1
  • 1
dm80
  • 1,228
  • 5
  • 20
  • 38
  • I set Anonymous Identity to Application Pool Identity. Now I see a different error in event log. "Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." Strange because i set caspol to FullTrust for this share. – dm80 Sep 22 '10 at 18:36

6 Answers6

35

Okay here's what I did to resolve my issue.

  1. Since my app files are in a file share the Anonymous user account couldn't access them. This is because by default IUSR account is used for Anoymous user. In IIS->Site->Authentication set Anonymous Authentication to Application Pool Identity if you have created a custom app pool OR you can specify an account.

  2. C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -m -ag 1 -url "file:////\computername\sharename*" FullTrust -exclusive on

dm80
  • 1,228
  • 5
  • 20
  • 38
  • 3
    +1 for step 1. that fixed my problem (nothing to do with a share, just IIS not serving images on a new site configured with a unique app pool identity). – ps2goat Jul 22 '15 at 05:51
  • Thank you. I had the exact same problem, site configured to use a service account, and I used failed request tracing to see the IUSR request was being used for all of the static content requests that were failing with a 500 error. This post was a big help after a lot of head scratching. – Patrick Montelo Jan 16 '17 at 21:06
34

For future solution-searchers having the same or similar problem... I had the same (or similar) problem with my little asp web app. But used this solution, which worked instantly:

The solution for me was to install the “Static Content” support for IIS.

  1. Go to “Turn Windows features on or off”
  2. Select Internet Information Services
  3. Select World Wide Web Services
  4. And check Static Content

Source: http://www.dailycomputersolutions.com/blog/index.php/2010/04/23/iis-not-showing-images-and-css/

Community
  • 1
  • 1
rho
  • 341
  • 3
  • 2
  • Please summarize the link in your answer. See also http://meta.stackexchange.com/questions/8231 – Robert Harvey Jun 25 '12 at 17:37
  • 4
    This was EXACTLY my problem. I don't understand why they would have Static Content off by default on a web server... what site doesn't use some kind of static content??? – eidylon Nov 12 '12 at 21:14
  • 1
    Thnakyou so much! I spent too much time on this incredibly stupid issue (What kind of web server does not support this by default?!?) – Kjartan Mar 19 '13 at 15:19
  • I'd hardly call "Turning Windows Features On or Off" an "instant" fix, but this solved my problem. It's stupid issues like this that make me hate ASP.Net and IIS. – Drew Chapin Aug 04 '13 at 15:43
10

In my case, I had the <staticContent> tag in the web.config file. I had to comment it, run the project (then all css, js, images loaded), uncomment it and run the project again, somehow it worked...

Tony
  • 12,405
  • 36
  • 126
  • 226
  • 1
    This worked for me as I recently added .woff mime type to my iis mappings but my web.config for an older site had the `` section to add it - they were obviously interfering - so removing from the web.config helped me – ajwaka Apr 07 '15 at 11:20
  • So it works commented out however I need those includes. Where's the alternative now? – Moustachio Aug 31 '16 at 22:43
  • My application also faced the same issue of not loading JS, CSS and IMAGES. This solution fixed the issue. – Vignesh Chinnaiyan Oct 17 '17 at 04:23
1

In addition to Authentication and all the other issues mentioned above, check your web application's Handler Mappings in IIS. The culprit could be a catch-all * handler hijacking your .css and .js requests.

In my case I recently installed ColdFusion on one of our servers and that added managed handlers to IIS making all the requests to asset files to throw a 500 Internal Server Error. I disabled that handler and everything went back to normal.

Socratees Samipillai
  • 2,985
  • 1
  • 20
  • 20
0

For me, the issue was with this part of my web.config:

  <authentication mode="Forms">
      <forms timeout="2880" loginUrl="/Home?expired=true" 
           requireSSL="false" protection="All" cookieless="UseCookies" />
  </authentication>

I had to change requireSSL from true to false when running under local host without https. Boom, CSS and images showed up.

Tyler Forsythe
  • 1,471
  • 17
  • 22
0

I forgot the permissions. https://serverfault.com/a/260778/30695 Had to add IIS_IUSRS with read permissions.

Community
  • 1
  • 1
JP Hellemons
  • 5,977
  • 11
  • 63
  • 128