在使用VS2012进行调试时发现加载数据为JSON格式的都加载不了,应该是MIME类型没有正确设置的问题。

直接通过浏览器地址栏访问时会收到提示,根据提示在IIS EXPRESS的安装目录下面执行一条命令即可:

appcmd set config /section:staticContent /+[fileExt
ension='.json',mimeType='text/plain']

如图:

VS调试时JSON格式文件加载不了-LMLPHP

或者可以在项目中的web.config中进行配置,configuration节中添加以下部份:

  <system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
</system.webServer>


05-11 12:50
查看更多