我使用Orchard CMS 1.10.1
。我在自定义主题的font
文件夹中创建了一个Content
文件夹。并在其中放入一些字体文件。
我在这样的css文件中使用这些文件:
@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;
}
但是当网站加载时,我在浏览器的控制台中会出现一些内部服务器错误:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
http://localhost:30321/OrchardLocal/Themes/Eshoper/Content/fonts/BYekan.woff
可能导致这种情况的原因是什么?
答案 0 :(得分:3)
您可能需要检查以下内容:
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
</staticContent>
</system.webServer>
此设置必须应用于Orchard.Web/web.config
。
Content
文件夹(如果它包含web.config
文件:<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<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" />
</handlers>
</system.webServer>
</configuration>
此文件将告诉Asp.Net该文件夹包含静态文件,此文件将由StaticFileModule
处理。