前言:
在本機撰寫D3js時,讀取json會找不到檔案就沒有顯示效果,這讓我對於D3js開發方式有了翻轉的概念!
問了指導教授後,知道關鍵在於Web.config ! 因為每個瀏覽器對於資料傳遞有不一樣的定義
所以在這Web.config設定mime 就能解決檔案讀不到的問題。在這次經驗中也學習到VS新增網站會自動產生
Web.config,再把自己原本的html複製進文件,掛上IIS後就跟一班網頁沒兩樣了!
第一種方法(較不正式):
Web.config內撰寫
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
第二種方法:
在IIS中的Mime新增
輸入完後確定 就能看到json資料畫出的圖了
留言列表