美文网首页Other
[IIS] 为IIS添加MIME Types

[IIS] 为IIS添加MIME Types

作者: 何幻 | 来源:发表于2016-03-05 08:07 被阅读54次

网站下有一个.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>

相关文章

网友评论

    本文标题:[IIS] 为IIS添加MIME Types

    本文链接:https://www.haomeiwen.com/subject/ydynkttx.html