Asp.net

Azure 上靜態內容(svg、woff、ttf)的 404

  • September 19, 2013

我正在嘗試將引導程序添加glyphicons-halflings-regular.svg到我的網站。本地一切正常,但在 Azue 我有 404 錯誤:

您要查找的資源已被刪除、名稱已更改或暫時不可用。

或者當我將以下staticContent部分添加到我的 web.config

<staticContent>
   <remove fileExtension=".woff" />
   <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
   <remove fileExtension=".ttf" />
   <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
   <remove fileExtension=".svg" />
   <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>

我收到了這個錯誤:

找不到路徑“/Content/fonts/glyphicons-halflings-regular.woff”的控制器或未實現 IController。

我應該如何正確配置我的 ASP.NET 站點以避免上述錯誤?

我沒有在解決方案中包含字型檔。這導致發佈網站不包含該文件。

我遇到了同樣的.woff文件問題。添加該副檔名的解決方案可以web.config正常工作:

<configuration>
 <system.webServer>
   <staticContent>
     <mimeMap fileExtension="woff" mimeType="application/font-woff" />
 </staticContent>
</system.webServer>

(參見原始解決方案:http: //www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites

引用自:https://stackoverflow.com/questions/18897079