0

I get the following error in my ASP.Net MVC page when running in IIS

downloadable font: download failed (font-family: "FontAwesome" style:normal weight:normal stretch:normal src index:1): status=2147746065 source: http://localhost/MyApp/fonts/fontawesome-webfont.woff?v=4.1.01 sharedStyle:1:126778

The same page running locally, everything works fine. All files are deployed and the path to FA is C:\inetpub\wwwroot\MyApp\Content\Template\font-awesome-4.1.0

I tried all solutions from Why font-awesome works on localhost but not on web ? and ASP.NET MVC4 Bundling with Twitter Bootstrap

UPDATE:

I added fileExtensions to system.webServer as suggested by Shyju, but it did not change the problem.

Is it possible that there is a problem with bundling? I use it in the following way:

public static void RegisterBundles(BundleCollection bundles)
{
  StyleBundle sharedStyleBundle = new StyleBundle("~/bundles/sharedStyle");
  sharedStyleBundle.Include("~/Content/Template/font-awesome-4.1.0/css/font-awesome.css");
  ...
  bundles.Add(sharedStyleBundle);
  ...
}
Community
  • 1
  • 1
StefanG
  • 1,234
  • 2
  • 22
  • 46

2 Answers2

0

IIS does not know how to serve these new types of files. We should explicitly tell that these are good file types.

Add this section to your web.config under <system.webServer> section. That should fix it.

<staticContent>   
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />      
  <mimeMap fileExtension=".otf" mimeType="font/otf" />     
  <mimeMap fileExtension=".woff" mimeType="font/x-woff" />     
  <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>

Sometimes, If it is already added ,you need to remove it and re-add it to avoid possible conflicts/errors.

<staticContent>
  <remove fileExtension=".eot" />
  <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
  <remove fileExtension=".otf" />
  <mimeMap fileExtension=".otf" mimeType="font/otf" />
  <remove fileExtension=".woff" />
  <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
  <remove fileExtension=".woff2" />
  <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
Shyju
  • 214,206
  • 104
  • 411
  • 497
0

I had to change the bundling as follows:

public static void RegisterBundles(BundleCollection bundles)
{
  StyleBundle sharedStyleBundle = 
    new StyleBundle("~/Content/Template/font-awesome-4.1.0/css/bundle");
  sharedStyleBundle
    .Include("~/Content/Template/font-awesome-4.1.0/css/font-awesome.css");
  bundles.Add(sharedStyleBundle);
  ...
}

It seems to be important, that the key for the bundle has the same structure as the bundle path itself.

StefanG
  • 1,234
  • 2
  • 22
  • 46