javascriptangularjsjsoniiswindows-hosting

Windows IIS wwwroot angular javascript serving up .json files not working


The website with index.html is located here http://www.example.com/index.html

The is using angular/javascript and i'm trying to serve up fake data with .json files locally I can do this just fine. Its just very simple javascript ... If i have any CORS issues the browser will tell me in developer tools and i just enable a CORS extension in chrome.

Problem:

Go here : http://www.example.com/index.html#/devices

Reason it seems that no data is showing is the obvious message in that it cannot locate this path

http://www.example.com/api/devices.json

What am I doing wrong?

This is where devices.json is located ... under wwwroot

/example.com/wwwroot/api


Solution

  • IIS is serving 404s (not found) for various reasons, to find out what the problem for your request is, without enabled detailed errors, look at the http log files, locate the request in question and find the http sub-status:

    192.168.1.200 GET /devices.json - 80 ... 404 3
    

    the number to the right of the 404 is the sub-status, in this case the 3 means: MIME type restriction. IIS by default is not configured to serve status files with a .json extension. You have add a new MIME Type mapping in IIS on the server or site level.