-4

I am trying to read a json file from my visual studio 2013 environment. It is throwing some error as mentioned below

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

However its working fine on plnkr http://plnkr.co/edit/std1ngB40YIJBmC94Zdm?p=preview

Can someone please let me know how to resolve the same ?

Error screen shot

enter image description here

Folder Structure enter image description here

enter image description here

Gaurav123
  • 5,059
  • 6
  • 51
  • 81

2 Answers2

-1

Have you set up the mime map correctly? I only see a screenshot for the handler mapping.

  1. Open IIS Manager
  2. Display properties for the IIS Server
  3. Click MIME Types and then add the JSON extension:
    • File name extension: .json MIME
    • type: application/json
  4. Go back to the properties for IIS Server
  5. Click on Handler Mappings
  6. Add a script map
    • Request path: *.json
    • Executable: C:\WINDOWS\system32\inetsrv\asp.dll
    • Name: JSON

If this still fails to work remove the script map completed and just stick with the mime map, I do not know why you are adding the script map in the first place.

James T
  • 1,155
  • 4
  • 17
  • 39
  • Please read the error carefully , you can see that ``If the page is a script, add a handler. If the file should be downloaded, add a MIME map.`` – Gaurav123 Sep 21 '15 at 12:33
  • @Gaurvav but the page is not a script? you are doing a `$http.get`which means the client is **downloading** the file not the server **executing** the file. Therefore, you need to set up a mime type so that the **download** request is correctly handled by the server. Follow my advice. **handler mappings** handle **server executable code**, **mime mappings** handle non-executable content usually streamed to the client. I believe it is you who needs to read the error correctly, this is a download. Not a script. – James T Sep 21 '15 at 13:03
  • I got your point and tried the same steps as you said but it didn't work. Do you have any idea what am I missing ? – Gaurav123 Sep 22 '15 at 04:37
-1

I done lot of research on this issue and finally its resolved :) :)

I tried the answer given by @James Trotter as well but didn't get success.

I don't know why MIME in IIS didn't work but it worked when I added it in web.config

SOLUTION :

  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>

For More Information

Allow loading of JSON files in Visual Studio Express 2013 for Web

Community
  • 1
  • 1
Gaurav123
  • 5,059
  • 6
  • 51
  • 81