2018年2月9日 星期五

利用jquery $.getJSON 於vs時出現HTTP 錯誤 404.3













需在web.config中加入

 <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>
完整於web.config內容如下
<?xml version="1.0"?>
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>
</configuration>

讓ASP.NET網站在開發除錯時期擁有WEB.CONFIG文件轉換功能

ref: https://blog.kkbruce.net/2016/09/enabling-xml-document-transforms-for-all-asp-net-web-by-develop-time.html#.XoP1KGMzbRY