4

We have a problem downloading .json files via IIS7.5.

MIME type has been set correctly:

 <mimeMap fileExtension=".json " mimeType="application/json" />

But still gives error: "HTTP Error 404.3 - Not Found".

To get it to work we have to add a handler mapping:

<handlers>
    <add name="JSON" path="*.json" verb="*" modules="IsapiModule" scriptProcessor="C:\WINDOWS\system32\inetsrv\asp.dll" resourceType="Unspecified" />
</handlers>

Why can't json files be handled by the StaticFileHandler like other static content? It seems bizarre we have to install classic asp support to handle json files.

buss
  • 100
  • 1
  • 10

2 Answers2

3

In my case a StaticFileHandler does handle json by itself. The asp.dll handler is not required.

Problem was a sneaky trailing space in the fileExtension property:

<mimeMap fileExtension=".json " mimeType="application/json" />

doh

buss
  • 100
  • 1
  • 10
1

Recently I ran into this problem too. First I added the .json MIME type. But I had placed my json file in the app_data folder. If you don't give the web application rights to that folder it won't work.

Try putting your json file in the same folder as the html file.

Also, the Mapping Handler won't work unless you have installed the Classic Asp module (in Windows Features). I've written some full directions here.

Community
  • 1
  • 1
bgmCoder
  • 6,205
  • 8
  • 58
  • 105
  • Thanks for your answer, it prompted me to review again. I was actually asking why a handler needs to be added at all - the staticfilehandler should be able to serve json. I've now managed to spot my problem, for me the classic asp module is now not required. – buss Mar 09 '14 at 11:05