Base solution for your next web application
Open Closed

.Woff files error 404 #478


User avatar
0
ofir1234 created

Hi. I am new to ASP.Net Boilerplate and I think it's a very cool project. I am currently using Boilerplate Module Zero for my web application. When I'm launching the project from my Visual Studio using Ctrl+F5, The icons are shown and everything is cool. When I publish my web project to my IIS 8.5 server and then surfing into my website, I'm getting the following errors in my console (and all of the fontawesome icons aren't working...I see some weird squares instead) :

http://mysite/Bundles/App/fonts/fontawesome-webfont.woff2?v=4.4.0 Failed to load resource: the server responded with a status of 404 (Not Found)
http://mysite/Bundles/App/vendor/famfamfam-flags.png Failed to load resource: the server responded with a status of 404 (Not Found)
http://mysite/Bundles/App/fonts/fontawesome-webfont.woff?v=4.4.0 Failed to load resource: the server responded with a status of 404 (Not Found)
http://mysite/Bundles/App/fonts/fontawesome-webfont.ttf?v=4.4.0 Failed to load resource: the server responded with a status of 404 (Not Found)

I tried the Mime workarounds here : <a class="postlink" href="http://stackoverflow.com/questions/25796609/font-face-isnt-working-in-iis-8-0">http://stackoverflow.com/questions/2579 ... in-iis-8-0</a> <a class="postlink" href="http://stackoverflow.com/questions/4015816/why-is-font-face-throwing-a-404-error-on-woff-files">http://stackoverflow.com/questions/4015 ... woff-files</a>

But nothing helped. Any suggestions ?

Thanks.


2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    This should work:

    <staticContent>
          <remove fileExtension=".woff" />
          <remove fileExtension=".woff2" />
          <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
          <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
        </staticContent>
    

    But your problem is different. Notice the path:

    <a class="postlink" href="http://mysite/">http://mysite/</a>Bundles/App/fonts/fontawesome-webfont.woff2?...

    It searhs bundles folder which does not exists actually. This is a problem of ASP.NET's bundling. Add CssRewriteUrlTransform to your CSS bundles. Example:

    //~/Bundles/App/vendor/css
                bundles.Add(
                    new StyleBundle("~/Bundles/App/vendor/css")
                        .Include("~/Content/themes/base/all.css", new CssRewriteUrlTransform())
                        .Include("~/Content/bootstrap-cosmo.min.css", new CssRewriteUrlTransform())
                        .Include("~/Content/toastr.min.css")
                        .Include("~/Scripts/sweetalert/sweet-alert.css")
                        .Include("~/Content/flags/famfamfam-flags.css", new CssRewriteUrlTransform())
                        .Include("~/Content/font-awesome.min.css", new CssRewriteUrlTransform())
                    );
    
  • User Avatar
    0
    ofir1234 created

    Great! Problem solved. Thanks.