2010-08-11 149 views
3

UDPATEIIS忽略system.webServer staticContent部分

一時心血來潮,我決定將4個字體文件上傳到字體轉換器。我將字體從ttf轉換爲ttf,然後嘗試使用它。一切工作正常:內容類型設置正確,X-Powered-By標題被刪除。
奇怪。


我試圖改變IIS7上web.config中.ttf文件的MIME類型(內容類型標頭)。

這裏是內部<system.webServer />的staticContent部分:

<staticContent> 
    <remove fileExtension=".ttf" /> 
    <mimeMap fileExtension=".ttf" mimeType="font/ttf" /> 
</staticContent> 

即使具有上述結構的所有.TTF文件與應用程序/ octetstream發送。

我也有以下內容的customHeader部分:

<remove name="X-Powered-By" /> 

它成功地消除了對CSS,PNG,JPG,GIF,ICO,的.aspx,熱媒和.html,SHTML的X-Powered-By報頭,並且js文件。但它並不適用於.ttf。

任何人都知道我在做什麼錯了?


我的整個web.config文件,以防萬一:

<?xml version="1.0" encoding="UTF-8"?> 
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use 
    the Website->Asp.Net Configuration option in Visual Studio. 
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 

    <system.codedom> 
    <compilers> 
     <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 
     <providerOption name="CompilerVersion" value="v3.5" /> 
     <providerOption name="WarnAsError" value="false" /> 
     </compiler> 
    </compilers> 
    </system.codedom> 
    <!-- 
     The system.webServer section is required for running ASP.NET AJAX under Internet 
     Information Services 7.0. It is not necessary for previous version of IIS. 
    --> 
    <system.webServer> 
    <validation validateIntegratedModeConfiguration="false" /> 
    <httpProtocol> 
     <customHeaders> 
     <remove name="X-Powered-By" /> 
     <add name="X-UA-Compatible" value="chrome=1;IE=edge" /> 
     </customHeaders> 
    </httpProtocol> 
    <modules> 
     <remove name="Session" /> 
     <remove name="WindowsAuthentication" /> 
     <remove name="FormsAuthentication" /> 
     <remove name="PassportAuthentication" /> 
     <remove name="RoleManager" /> 
     <remove name="UrlAuthorization" /> 
     <remove name="FileAuthorization" /> 
     <remove name="AnonymousIdentification" /> 
     <remove name="Profile" /> 
    </modules> 
    <staticContent> 
     <remove fileExtension=".ttf" /> 
     <mimeMap fileExtension=".ttf" mimeType="font/ttf" /> 
    </staticContent> 
    </system.webServer> 
    <runtime> 
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" appliesTo="v2.0.50727"> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /> 
     </dependentAssembly> 
     <dependentAssembly> 
     <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" /> 
     <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /> 
     </dependentAssembly> 
    </assemblyBinding> 
    </runtime> 
</configuration> 

回答

2

定盤設置runAllManagedModulesForAllRequeststrue

<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"> 
     <!-- stuff --> 
    </modules> 
</system.webServer>