Hossein Panahloo Hossein Panahloo - 2 months ago 16x
CSS Question

Internal server error in browser console when loading font.woff resource in Orchard cms

I use

Orchard CMS 1.10.1
. I have created a
folder inside
folder in my custom theme. And put some font files in there.

And I use these files in a css file like this:

@font-face {
font-family: 'B-Yekan';
src: url(../Content/fonts/BYekan.eot) !important;
src: url(../Content/fonts/BYekan.otf), url(../Content/fonts/BYekan.woff) format('woff'), url(../Content/fonts/BYekan.ttf) format('truetype'), url(../Content/fonts/BYekan.svg#VitaminRegular) format('svg');
font-weight: normal;
font-style: normal;

But when website loads, I get some Internal server errors in browser's console like this:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

What might be causing this?


You might need to check the following:

  1. register your fonts mime types in web.config file, like this:
        <remove fileExtension=".woff" />
        <mimeMap fileExtension=".woff" mimeType="application/font-woff" />

This settings must be applied on Orchard.Web/web.config.

  1. Check youContent folder if it contains a web.config file, with this configuration:
<?xml version="1.0" encoding="utf-8"?>
            <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
        <handlers accessPolicy="Script,Read">
            <!-- For any request to a file exists on disk, return it via native http module. AccessPolicy="Script" above is to allow for a managed 404 page. -->
            <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />

This file will tell Asp.Net that this folder contains static files, and this files will be handled by StaticFileModule.