How can I enable the download of *.json files from an old ASP.NET site (IIS6 I am led to believe)?
我如何开启*的下载。来自旧ASP的json文件。网站(IIS6我被引导相信)?
I am getting a 404 page instead of the JSON file.
我得到的是404页面而不是JSON文件。
Do I need to create a web.config file? What goes in it?
我需要创建一个网络吗?配置文件?这是什么?
6 个解决方案
#1
104
Add the JSON MIME type to IIS 6. Follow the directions at MSDN's Configure MIME Types (IIS 6.0).
将JSON MIME类型添加到IIS 6。遵循MSDN的配置MIME类型(IIS 6.0)的说明。
- Extension: .json
- 扩展:. json
- MIME type: application/json
- MIME类型:application / json
Don't forget to restart IIS after the change.
不要忘记在更改之后重新启动IIS。
UPDATE: There are easy ways to do this on IIS7 and newer. The op specifically asked for IIS6 help so I'm leaving this answer as-is. But this answer is still getting a lot of traffic even though IIS6 is very old now. Hopefully you're using something newer, so I wanted to mention that if you have a newer IIS7 or newer version see @ProVega's answer below for a simpler solution for those newer versions.
更新:在IIS7和更新版本中,有一些简单的方法可以做到这一点。op特别要求IIS6的帮助,所以我留下了这个答案。尽管IIS6现在已经很老了,但这个答案仍然有很多流量。希望您正在使用更新的东西,因此我想指出,如果您有更新的IIS7或更新的版本,请参阅下面的@ProVega的答案,以获得更新版本的更简单的解决方案。
#2
191
If you want to manually add support to your site, you can just add the following to your web.config in the system.webServer section:
如果您想手工向站点添加支持,您可以将以下内容添加到web中。系统中配置。网络服务器:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
This will add a "local" configuration under IIS. This does not work in IIS6, but does work in IIS7 and newer.
这将在IIS下添加“本地”配置。这在IIS6中不适用,但在IIS7和更新版本中也适用。
#3
14
Solution is you need to add json file extension type in MIME Types
Method 1
Go to IIS, Select your application and Find MIME Types
转到IIS,选择应用程序并找到MIME类型
Click on Add from Right panel
从右面板单击Add
File Name Extension = .json
文件扩展名= .json。
MIME Type = application/json
MIME类型= application / json
After adding .json file type in MIME Types, Restart IIS and try to access json file
在MIME类型中添加.json文件类型之后,重新启动IIS并尝试访问json文件
Method 2
Go to web.config of that application and add this lines in it
去网上。配置该应用程序并在其中添加这一行
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
#4
5
Just had this issue but had to find the config for IIS Express so I could add the mime types. For me, it was located at C:\Users\<username>\Documents\IISExpress\config\applicationhost.config
and I was able to add in the correct "mime map" there.
只是遇到了这个问题,但是必须为IIS Express找到配置,以便我可以添加mime类型。对我来说,它是位于C:\Users\ <用户名> \ \ IISExpress \ config \ applicationhost文档。配置和我可以在那里添加正确的“mime映射”。
#5
3
When adding support for mimetype (as suggested by @ProVega) then it is also best practice to remove the type before adding it - this is to prevent unexpected errors when deploying to servers where support for the type already exists, for example:
在添加对mimetype的支持(如@ProVega所建议的)时,最好在添加该类型之前删除该类型——这是为了防止在部署到支持该类型的服务器时出现意外错误,例如:
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
#6
0
- Navigate to C:\Users\username\Documents\IISExpress\config
- 导航到C:\Users\username\Documents\IISExpress\config
- Open applicationhost.config with Visual Studio or your favorite text-editor.
- applicationhost开放。使用Visual Studio或您最喜欢的文本编辑器进行配置。
- Search for the word mimeMap, you should find lots of 'em.
- 搜索mimeMap这个词,你会找到很多。
- Add the following line to the top of the list: .
- 将以下一行添加到列表的顶部:。
#1
104
Add the JSON MIME type to IIS 6. Follow the directions at MSDN's Configure MIME Types (IIS 6.0).
将JSON MIME类型添加到IIS 6。遵循MSDN的配置MIME类型(IIS 6.0)的说明。
- Extension: .json
- 扩展:. json
- MIME type: application/json
- MIME类型:application / json
Don't forget to restart IIS after the change.
不要忘记在更改之后重新启动IIS。
UPDATE: There are easy ways to do this on IIS7 and newer. The op specifically asked for IIS6 help so I'm leaving this answer as-is. But this answer is still getting a lot of traffic even though IIS6 is very old now. Hopefully you're using something newer, so I wanted to mention that if you have a newer IIS7 or newer version see @ProVega's answer below for a simpler solution for those newer versions.
更新:在IIS7和更新版本中,有一些简单的方法可以做到这一点。op特别要求IIS6的帮助,所以我留下了这个答案。尽管IIS6现在已经很老了,但这个答案仍然有很多流量。希望您正在使用更新的东西,因此我想指出,如果您有更新的IIS7或更新的版本,请参阅下面的@ProVega的答案,以获得更新版本的更简单的解决方案。
#2
191
If you want to manually add support to your site, you can just add the following to your web.config in the system.webServer section:
如果您想手工向站点添加支持,您可以将以下内容添加到web中。系统中配置。网络服务器:
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
This will add a "local" configuration under IIS. This does not work in IIS6, but does work in IIS7 and newer.
这将在IIS下添加“本地”配置。这在IIS6中不适用,但在IIS7和更新版本中也适用。
#3
14
Solution is you need to add json file extension type in MIME Types
Method 1
Go to IIS, Select your application and Find MIME Types
转到IIS,选择应用程序并找到MIME类型
Click on Add from Right panel
从右面板单击Add
File Name Extension = .json
文件扩展名= .json。
MIME Type = application/json
MIME类型= application / json
After adding .json file type in MIME Types, Restart IIS and try to access json file
在MIME类型中添加.json文件类型之后,重新启动IIS并尝试访问json文件
Method 2
Go to web.config of that application and add this lines in it
去网上。配置该应用程序并在其中添加这一行
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
#4
5
Just had this issue but had to find the config for IIS Express so I could add the mime types. For me, it was located at C:\Users\<username>\Documents\IISExpress\config\applicationhost.config
and I was able to add in the correct "mime map" there.
只是遇到了这个问题,但是必须为IIS Express找到配置,以便我可以添加mime类型。对我来说,它是位于C:\Users\ <用户名> \ \ IISExpress \ config \ applicationhost文档。配置和我可以在那里添加正确的“mime映射”。
#5
3
When adding support for mimetype (as suggested by @ProVega) then it is also best practice to remove the type before adding it - this is to prevent unexpected errors when deploying to servers where support for the type already exists, for example:
在添加对mimetype的支持(如@ProVega所建议的)时,最好在添加该类型之前删除该类型——这是为了防止在部署到支持该类型的服务器时出现意外错误,例如:
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
#6
0
- Navigate to C:\Users\username\Documents\IISExpress\config
- 导航到C:\Users\username\Documents\IISExpress\config
- Open applicationhost.config with Visual Studio or your favorite text-editor.
- applicationhost开放。使用Visual Studio或您最喜欢的文本编辑器进行配置。
- Search for the word mimeMap, you should find lots of 'em.
- 搜索mimeMap这个词,你会找到很多。
- Add the following line to the top of the list: .
- 将以下一行添加到列表的顶部:。