网站下有一个.json
文件,使用get方式请求,会发生如下错误:
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
原因:
IIS没有注册.json
文件的MIME类型。
解决方案:
(1)inetmgr -> IIS -> MIME Types -> add ->
File Name extension: json
MIME Type:text/plain
(2)或者在web.config中配置,
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
网友评论