14

I just published an AngularJS/WebAPI project using File system publish to a local IIS Application and I can open the website in my browser. Unfortunately, no resources such as images, css etc. can be loaded. When I try to reach any file located in a sub folder I still receive a HTTP 200 from the server, but the body is empty. I can remember I´ve had this issue a few years back but I can´t remember why this happens.

Request

GET http://localhost/Content/images/common/logotype.png HTTP/1.1
Host: XX.XXX.XX.XXX
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.130 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,sv;q=0.6

Response

HTTP/1.1 200 OK
Server: Microsoft-IIS/8.5
X-Powered-By: ASP.NET
Date: Tue, 25 Aug 2015 07:56:12 GMT
Content-Length: 0

As you can see, there is no body at all but the image exists in the folder and I can open it from the filesystem. I would guess that if this was a privilege issue the server would return 403 or a similar error, not 200 OK?

Marcus
  • 8,230
  • 11
  • 61
  • 88
  • Perhaps try adding `image/png` to your `Accept` header and see if you get content back? – Niels Filter Aug 25 '15 at 08:26
  • Is it a SPA? If yes - can you show your webconfig? – kamil-mrzyglod Aug 25 '15 at 08:30
  • Yes, it is an angular SPA I suppose, but I cannot provide the entire web.config for privacy reasons. Maybe I can provide a particular section of interest? – Marcus Aug 25 '15 at 08:47
  • 1
    Can you check the permissions on the local folder? The user that runs the applicationpool needs to have permission to the folders that has the images – Marcus Höglund Aug 25 '15 at 08:59
  • The user has permission, besides, wouldn´t the result of a permission problem return a 403? – Marcus Aug 25 '15 at 09:57
  • Did you try directly browsing url http://localhost/Content/images/common/logotype.png? Not using application but directly typing in browser' address bar. – Pankaj Kapare Aug 25 '15 at 11:04
  • 2
    What IIS features did you enable? – Lex Li Aug 25 '15 at 11:08
  • @PankajKapare, That´s exactly what I tried and using Fiddler I can see the request and the response. – Marcus Aug 25 '15 at 11:43
  • And response you are getting with this method is empty. Right? Or is it valid response? – Pankaj Kapare Aug 25 '15 at 11:54
  • @PankajKapare, I am certain that you are able to draw the answer to those questions from reading the question I posed. The raw response is pasted and as you can see it is a valid 200 OK Response with Content-Length: 0. – Marcus Aug 25 '15 at 12:03

1 Answers1

22

Facepalm

Turns out that Lex Li:s comment put me in the right direction. I had completely missed to include the "Static Content" feature was missing in IIS "Common HTTP Features".

Adding the "Static Content" feature

Marcus
  • 8,230
  • 11
  • 61
  • 88