404 on static content (svg,woff,ttf) on Azure
Solution 1
I did not include font files in solution. This caused that publishing website does not contains this files.
Solution 2
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)
Solution 3
When I put the suggested lines into web.config
it didn't work. Instead I put the following lines into Web.config
(note the capital letter)
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension="woff" mimeType="application/font-woff" />
<mimeMap fileExtension="woff2" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
Solution 4
If you are using the continuous deployment on Azure, verify that the "build action" of all the files that you need is Content and not None.
Piotr Stapp
I'm a developer, an engineer, and a teacher. I’m adept at DevOps and automation. I'm in love with web technologies. I'm CxO at dotnetomaniak. I’m Microsoft MVP. Some links: Blog: https://stapp.space LinkedIn: https://www.linkedin.com/in/piotrstapp
Updated on August 16, 2020Comments
-
Piotr Stapp over 3 years
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?