I'm serving .JSON files, but even though the file exist, IIS keeps throwing 404 error when any of the file is accessed. I tried renaming one of the file to .JS, and it works.

Any pointer what setting can cause this issue?

6 Answers 6


By default, IIS in W2K3 and above won't serve files that aren't of a MIME type that it knows about (instead returning 404 errors).

You need to add a MIME type to IIS to allow it to serve that type of file. You can set it at the site level or at the server level.

To set this for the entire server:

  • Open the properties for the server in IIS Manager and click MIME Types
  • Click "New". Enter "JSON" for the extension and "application/json" for the MIME type.
  • I add a new MIME type, restart the web site, but still 404. Thanks anyway, I think this may be one of the issue. Jul 13, 2009 at 17:24
  • Hmm. Double-check what you've changed. The "renamed the file and it worked" symptom is the classic indicator of this behaviour. Jul 13, 2009 at 17:45
  • Triple checked it. I'm assuming that you don't need to restart the whole server, right? Jul 13, 2009 at 17:46
  • Hmm... I'm stuggling to tell you what to do, then. I just did it myself in a clean VM of Windows Server 2003 SP2. I installed IIS, created a "foo.json" file in "C:\inetpub\wwwroot", verified that I got a 404 when I hit "localhost/foo.json" in a browser, added the MIME type for ".JSON"/"application/json" to the site, then went over to my still-open IE window and hit F5 and saw the page load. I think you've got something else in play, too. Jul 13, 2009 at 18:02
  • 1
    I also needed to make sure Web Service Extensions were enabled to make this work for me...
    – kind_robot
    Nov 14, 2011 at 20:26

I had the same problem. IIS does something called MIME type filtering. If it dosn't know a specific file extension's MIME type, it returns a 404 error.

On IIS <7: Open the site (or server) properties. Click on the HTTP-Header tab. Click on the MIME Types button. Add the file type * with the MIME type "application/octet-stream".

For IIS 7: Open IIS manager. Click the server or website. Double-click the MIME Types feature icon. In the Actions pane, click Add. Populate the "File Name Extension" box with * and the MIME Type box with "application/octet-stream".


I added MIME type .json - text/json to the site in IIS to view in browser as text.

  • THIS! THIS! This! Dec 11, 2015 at 10:22

To consolidate answers into one more general answer:

Here comes the caveat:

  • Unless a script handler (active content engine, eg, ASP/ASPX/PHP/Java/ISAPI/etc) is associated with them
    • this means that IIS treats them as active content, not static files
  • Active content files served by any extension must have that extension allowed in the Web Service Extensions restriction list (aka ISAPI/CGI restrictions in IIS 7)
    • if you're getting a 404 on an active content type in IIS 7, it may also mean your handler is not installed - so you need to actually go install the component that supports that file extension (for example, if .aspx files generate a 404, you probably don't have ASP.Net installed)

If you're experiencing this sort of problem, open up the website's web log files, and have a look at the sub-status code (i.e. 404 3) to determine exactly why your website isn't serving content for IIS 6, or

  • use Failed Request Tracing
  • (or just the detailed errors on the local console)

in IIS 7.

  • This "caveat" doesn't make sense: "...this means that IIS treats them as active content, not static files" Web.config declares json files as static: <staticContent> <mimeMap fileExtension=".json" mimeType="application/json" /> </staticContent>
    – user209576
    Feb 16, 2014 at 12:47
  • "IIS won't serve static files that don't have a MIME type associated with them unless a script handler is associated with them" still works as (IMO) a true statement. In the case of someone unable to serve them, it sounds like theirs doesn't have this definition in their config files anywhere. Perhaps your copy of Windows is more recent than theirs?
    – TristanK
    Apr 30, 2014 at 7:40

I had this problem too - and the problem turned out to be file permissions on the folder where the json file was stored. I answered a similar question here.

These folks are all correct to say you need to add the MIME type.

The MIME type enables the file extension on the server and the Mapping Handler tells IIS what to do with it.

So you also have to add the Mapping Handler, and for that you have to have the Windows Feature called Classic Asp installed in order to handle the mapping.

Here is how to add the Mapping Handler:

  1. Open IIS7 Manager
  2. Go to the properties for IIS Server (or just the site, if you don't want a global setting)
  3. Click on Handler Mappings
  4. Click on Add a Script Map
  5. Enter the properties:
    • Request Path: *.json
    • Executable: C:\WINDOWS\system32\inetsrv\asp.dll
    • Name: JSON (you can call it anything you like)
  6. Click OK, and you are done. It should start working and you don't need an IIS reset.

Also, some folks will tell you to use `application/x-javascript' as the mime-type application, but JSON is not javascript, per se (it is a subset, however) and so it should be 'application/json' instead, as it is that IANA-registered media type for JSON.


Also check Request Filtering in IIS. If ".json" is there and blocked, nothing else will work.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.