Get IIS6 to serve JSON files (inc. POST,GET)?

JsonIisIis 6

Json Problem Overview


By default, IIS6 does not serve .json (no wildcard MIME type).

Therefore a 404 not found is thrown. I then add a new MIME type (.json, text/plain or application/x-javascript or application/json) which works fine.

However, when you then add a new mapping (Home Directory -> Configuration -> Add) with .json, C:\WINDOWS\system32\inetsrv\asp.dll, "GET,POST" and try to browse to the file, you get a 404.

If you remove the mapping and try and POST or GET to it, you get a 405.

...

Suggestions?

Json Solutions


Solution 1 - Json

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.

Update

Given this post is found in the Sencha "getting started guide", I thought it's worth upgrading the steps.

On Win 7 Enterprise SP 1 with 64-bit The IIS has a different outlook. So the steps:

*. Open IIS Manager. Then you get following window.

enter image description here

*. Right click on MIME and choose open feature

*. Click on ADD from top right corner Actions menu

enter image description here

*. Rest is as per Evan's.

Solution 2 - Json

Make sure you have Active Server Pages Allowed in the Web Service Extensions section of your IIS configuration.

IIS Manager -> (local computer) -> Web Service Extensions -> Active Server Pages

Solution 3 - Json

If you don't have IIS installed, obviously, you'll want to install it prior to launching the IIS Manager. I needed (on Windows 7) to go to: 'control panel/program and features' then click 'turn windows features on or off'

Reference: http://www.howtogeek.com/howto/windows-vista/how-to-install-iis-on-windows-vista/

It appears that starting the IIS Manager is different for different systems. I did 'start/run/inetmgr.

Reference: http://msdn.microsoft.com/en-us/library/bb763170(v=vs.100).aspx

Reference: http://technet.microsoft.com/en-us/library/cc770472(v=ws.10).aspx

Troy Frericks.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRhysView Question on Stackoverflow
Solution 1 - JsonEvan AndersonView Answer on Stackoverflow
Solution 2 - JsonDan WilliamsView Answer on Stackoverflow
Solution 3 - JsonTroy FrericksView Answer on Stackoverflow