获取 IIS6 以提供 JSON 文件(包括 POST、GET)? [英] Get IIS6 to serve JSON files (inc. POST,GET)?
问题描述
默认情况下,IIS6 不提供 .json(无通配符 MIME
类型).
By default, IIS6 does not serve .json (no wildcard MIME
type).
因此抛出 404 not found.然后我添加一个新的 MIME 类型 (.json, text/plain or application/x-javascript or application/json)
它工作正常.
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.
然而,当你添加一个新的映射 (Home Directory -> Configuration -> Add) with .json, C:WINDOWSsystem32inetsrvasp.dll
, "GET,POST
" 并尝试浏览到该文件,您会得到一个 404.
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.
如果您删除映射并尝试 POST 或 GET
到它,您会得到 405
.
If you remove the mapping and try and POST or GET
to it, you get a 405
.
...
建议?
推荐答案
默认情况下,W2K3 及更高版本中的 IIS 不会提供不属于它知道的 MIME 类型的文件(而是返回 404 错误).
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).
您需要向 IIS 添加 MIME 类型,以允许它为该类型的文件提供服务.您可以在站点级别或服务器级别进行设置.
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.
要为整个服务器设置:
- 在 IIS 管理器中打开服务器的属性,然后单击 MIME 类型
- 点击新建".为扩展输入JSON",为 MIME 类型输入application/json".
鉴于这篇文章是在 Sencha入门指南"中找到的,我认为值得升级步骤.
Given this post is found in the Sencha "getting started guide", I thought it's worth upgrading the steps.
在 64 位的 Win 7 Enterprise SP 1 上IIS 有不同的看法.所以步骤:
On Win 7 Enterprise SP 1 with 64-bit The IIS has a different outlook. So the steps:
*.打开 IIS 管理器.然后你会得到以下窗口.
*. Open IIS Manager. Then you get following window.
*.右键单击 MIME 并选择 open feature
*. Right click on MIME and choose open feature
*.点击右上角操作菜单中的添加
*. Click on ADD from top right corner Actions menu
*.休息是按照埃文的.
*. Rest is as per Evan's.
这篇关于获取 IIS6 以提供 JSON 文件(包括 POST、GET)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!