Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

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

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:WINDOWSsystem32inetsrvasp.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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...