Visual Studio IIS Express 不支持.json后缀的mime类型

vs默认web调试工具中并不支持.json后缀的mime类型。

如何解决,两个方案:

局部单应用:web.config:

<system.webServer>
。。。。   
 <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/x-javascript" />
    </staticContent>
  </system.webServer>

还一个方案,IIS Express全局(未测试):

1、若要设置 MIME 类型,请在 IIS Express 安装目录中运行以下命令: appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string']
2、变量 fileExtension 字符串是文件扩展名,变量 mimeType 字符串是文件类型说明。
3、例如,要为扩展名为“.xyz”的文件添加 MIME 映射: appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']

posted @ 2013-08-29 18:44  jackchain  阅读(2014)  评论(0编辑  收藏  举报