2016-08-13 75 views
1

我使用Orchard CMS 1.10.1。我在自定义主题中的Content文件夹内创建了一个font文件夹。并在其中放置一些字体文件。在Orchard cms中加载font.woff资源时在浏览器控制台中发生内部服务器错误

而且我在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 

可能是什么造成这个?

回答

3

您可能需要检查以下内容:

  1. 注册您的字体MIME类型在web.config文件中,就像这样:
<system.webServer> 
    <staticContent> 
     <remove fileExtension=".woff" /> 
     <mimeMap fileExtension=".woff" mimeType="application/font-woff" /> 
    </staticContent> 
</system.webServer> 

此设置必须在Orchard.Web/web.config应用。

  • 检查你,如果它包含web.config文件,这个配置Content文件夹:
  • <?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处理。

    +0

    感谢您的回答,我检查了web.config文件,它已经有了这段代码。在我的情况下,问题可能是别的。 –

    +0

    请检查更新的答案。 – mdameer

    +1

    再次感谢,是的,我检查了内容文件夹,它已经有这个文件,但我的字体文件夹(这是内容文件夹内)也有这个文件。我删除了字体文件夹内的web.config文件,并解决了这个问题。 –

    相关问题