404 on static content (svg,woff,ttf) on Azure

Piotr Stapp picture Piotr Stapp · Sep 19, 2013 · Viewed 23.7k times · Source

I am trying to add bootstrap glyphicons-halflings-regular.svg to my web site. Locally everything works fine, but on Azue I have 404 errors:

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

or when I add below staticContent section to my 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>

I got this error:

The controller for path '/Content/fonts/glyphicons-halflings-regular.woff' was not found or does not implement IController.

How should I proper configure my ASP.NET site to avoid above errors?

Answer

eldi picture eldi · Aug 1, 2014

I hit the same problem with .woff file. Solution with adding that extension to web.config works fine:

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

(see oryginal solution: http://www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites)