2016-08-13 25 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文件,並解決了這個問題。 –

    相關問題