0

My .net application when compiled in Visual studio through IIS express, works perfectly fine. The style sheets are getting loaded correctly. But when I host the application in IIS, the style sheets are not getting loaded correctly. I found a lot of similar questions but none of them is working in my case. I am seeing the below error:

enter image description here

Things I tried:

  1. Static content enabled
  2. Permissions provided for IUSR
  3. Anonymous authentication for App pool identity has been enabled
Rick
  • 1,392
  • 1
  • 21
  • 52
  • Does this answer your question? [relative path to CSS file](https://stackoverflow.com/questions/17621324/relative-path-to-css-file) – Troy Turley May 13 '20 at 13:28
  • "But when I host the application in IIS", then show enough of your IIS configuration for this application (like key fragments from applicationHost.config) and don't let others guess. – Lex Li May 13 '20 at 13:51

3 Answers3

2

Thanks all for helping me with answers and for down voting my question. I tried all the options mentioned in this question and other related questions. What worked for me was, I edited the 'domain' on my web.config as 'localhost' to 'localhost/projectfolder' and it worked. Additionally I edited the Static handler and re-saved it. so it worked!

Rick
  • 1,392
  • 1
  • 21
  • 52
1

First, make sure CSS and js mime type is available and the mime types are correct.

then check the static handler mapping.

enter image description here

Both jQuery and CSS files are purely client-side entities, so check up the presence of the files and their path names in each HTML file using jQuery and CSS. Normally, people use relative path names to reference any kind of files in HTML files; and the relative path should be a path relative to the location of a using file, HTML, .aspx, etc. Just check it up.

if you still face issue then try to run failed requests tracing in iis:

http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26
0

Look if you have set something like in your head of index.html.

<base href="/" />
Jack7
  • 1,310
  • 12
  • 16