乌达特
一时兴起,我决定把4种字体文件上传到一个字体转换器上。我把字体从TTF转换为TTF,然后尝试了一下。一切正常:内容类型设置正确,X-powered-by头被删除。
奇怪的。
我正在尝试更改iis7上web.config中.ttf文件的mime类型(content-type-header)。
这是里面的StaticContent部分
<system.webServer />
:
<staticContent>
<remove fileExtension=".ttf" />
<mimeMap fileExtension=".ttf" mimeType="font/ttf" />
</staticContent>
即使使用上述配置,所有.ttf文件也将与application/octetstream一起发送。
我还有一个CustomHeader部分,其中包含以下内容:
<remove name="X-Powered-By" />
它成功地删除了
X-Powered-By
css,png,jpg,gif,ico,.aspx,.htm,.html,shtml和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>