获取 IIS6 以提供 JSON 文件(包括 POST、GET)?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/332988/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get IIS6 to serve JSON files (inc. POST,GET)?
提问by Evan Anderson
By default, IIS6 does not serve .json (no wildcard MIMEtype).
默认情况下,IIS6 不提供 .json(无通配符MIME类型)。
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.
因此会抛出 404 not found。然后我添加一个新的 MIME 类型(.json, text/plain or application/x-javascript or application/json),它工作正常。
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.
但是,当您随后添加新映射(Home Directory -> Configuration -> Add) with .json, C:\WINDOWS\system32\inetsrv\asp.dll“ GET,POST”并尝试浏览到该文件时,您会收到 404。
If you remove the mapping and try and POST or GETto it, you get a 405.
如果您删除映射并尝试POST or GET使用它,您会得到一个405.
...
...
Suggestions?
建议?
回答by Evan Anderson
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).
默认情况下,W2K3 及更高版本中的 IIS 不会提供不属于它知道的 MIME 类型的文件(而是返回 404 错误)。
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.
您需要将 MIME 类型添加到 IIS 以允许它为该类型的文件提供服务。您可以在站点级别或服务器级别设置它。
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.
- 在 IIS 管理器中打开服务器的属性,然后单击 MIME 类型
- 单击“新建”。为扩展输入“JSON”,为 MIME 类型输入“application/json”。
Update
更新
Given this post is found in the Sencha "getting started guide", I thought it's worth upgradingthe steps.
鉴于这篇文章是在 Sencha“入门指南”中找到的,我认为值得升级这些步骤。
On Win 7 Enterprise SP 1 with 64-bit The IIS has a different outlook. So the steps:
在 64 位的 Win 7 Enterprise SP 1 上 IIS 有不同的前景。所以步骤:
*. Open IIS Manager. Then you get following window.
*. 打开 IIS 管理器。然后你会得到以下窗口。


*. Right click on MIME and choose open feature
*. 右键单击 MIME 并选择open feature
*. Click on ADD from top right corner Actions menu
*. 单击右上角的“操作”菜单中的“添加”


*. Rest is as per Evan's.
*. 休息是按照埃文的。
回答by Dan Williams
Make sure you have Active Server Pages Allowed in the Web Service Extensions section of your IIS configuration.
确保在 IIS 配置的 Web 服务扩展部分中允许使用 Active Server Pages。
IIS Manager -> (local computer) -> Web Service Extensions -> Active Server Pages
IIS 管理器 ->(本地计算机) -> Web 服务扩展 -> Active Server Pages
回答by Troy Frericks
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'
如果您没有安装 IIS,很明显,您需要在启动 IIS 管理器之前安装它。我需要(在 Windows 7 上)转到:“控制面板/程序和功能”,然后单击“打开或关闭 Windows 功能”
Reference: http://www.howtogeek.com/howto/windows-vista/how-to-install-iis-on-windows-vista/
参考: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.
对于不同的系统,似乎启动 IIS 管理器是不同的。我做了'开始/运行/inetmgr。
Reference: http://msdn.microsoft.com/en-us/library/bb763170(v=vs.100).aspx
参考: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
参考:http: //technet.microsoft.com/en-us/library/cc770472(v=ws.10).aspx
Troy Frericks. #
特洛伊弗里克斯。#

