Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp fontawesome 404 (not found)

I have this error both on my production IIS7 server and on local iisexpres (after I've set debug="false")

GET http://localhost:64231/font/fontawesome-webfont.woff?v=3.2.1 404 (Not Found) jquery-1.11.0.min.js:2
GET http://localhost:64231/font/fontawesome-webfont.ttf?v=3.2.1 404 (Not Found) localhost/:1
GET http://localhost:64231/font/fontawesome-webfont.svg 404 (Not Found) 

I've added mime types to web.config. Also I've added they to IIS

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

What am I doing wrong?

like image 257
Aray Karjauv Avatar asked May 13 '14 11:05

Aray Karjauv


3 Answers

When you set debug value to false, it will automatically enable optimisations for the bundles. Instead of having, in your html generated code (by example) :

<link href="/content/bootstrap-3.3.5.min.css" rel="stylesheet"/>
<link href="/content/font-awesome.min.css" rel="stylesheet"/>

You will have something like this :

<link href="/Styles?v=ca92niiBlGWlTNkBwoMTPgQGz9_5Ghi39pZxcx5Dyfk1" rel="stylesheet"/>

This is why your paths are not correct anymore. I think setting absolute paths is a correct way to resolve this problem.

If you don't want to automatically enable optimization when your application is in release mode (debug="false"), you can add this line to your file /App_Start/BundleConfig.cs :

BundleTable.EnableOptimizations = false;

EDIT : I just seen the date of your question... I came here because I ran into the same issue yesterday. I hope my explanation will help somebody.

like image 129
KevinM Avatar answered Sep 19 '22 14:09

KevinM


The problem was in relative path to fonts. I've replaced it with absolute path url('/content/FontAwesome/font/...');

like image 37
Aray Karjauv Avatar answered Sep 21 '22 14:09

Aray Karjauv


all last responses don't work for me. I can see that the url requested by the page to the resource is like 'YourWebsite/fonts/fontawesome-webfont.woff2?v=4.7.0'

Then i decide generate the fontawesome bundle with the path "~/bundles/fonts"

bundles.Add(new StyleBundle("~/bundles/fonts") .Include("~/Content/font-awesome.css", new CssRewriteUrlTransform()));

then worked for me

like image 40
Marcelo Arturo Duarte Avatar answered Sep 19 '22 14:09

Marcelo Arturo Duarte