尽管在IIS中安装了woff,ttf,svg和eot 404的MIME类型 [英] MIME Types for woff, ttf, svg, and eot 404ing despite being setup in IIS

查看:246
本文介绍了尽管在IIS中安装了woff,ttf,svg和eot 404的MIME类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在一个文件中得到一个字体,它给了我通常的错误:

 资源解释作为字体,但与MIME类型的文本/ HTML传输:

但显示的HTML文件是我们的404。 aspx文件,我尝试了通常在web.config中安装应用程序,然后最终到IIS本身:

  .woff application / font-woff 
.ttf application / font-ttf
.eot application / vnd.ms-fontobject
.otf application / font-otf
.svg image / svg + xml

我无法理解我要出错的地方。这些文件存储在一个名为字体的文件夹中,该文件夹位于网站的基本目录中,并且我的aspx文件中包含了样式

  @ font-face {
font-family:'segoe_printregular';
src:url('/ fonts / segoepr-webfont.eot'); / * IE9兼容模式* /
src:url('/ fonts / segoepr-webfont.eot?#iefix')格式('embedded-opentype'),/ * IE6-IE8 * /
url ('/fonts/segoepr-webfont.woff')格式('woff'),/ *现代浏览器* /
url('/ fonts / segoepr-webfont.ttf')格式('truetype'),/ * Safari,Android,iOS * /
url('/ fonts / segoepr-webfont.svg#svgFontName')format('svg'); / *传统的iOS * /
font-weight:normal;
font-style:normal;
}

以及字体文件夹中的stylesheet.css为:

  @ font-face {
font-family:'segoe_printregular';
src:url('/ segoepr-webfont.eot'); / * IE9兼容模式* /
src:url('/ segoepr-webfont.eot?#iefix')格式('embedded-opentype'),/ * IE6-IE8 * /
url /segoepr-webfont.woff格式('woff'),/ *现代浏览器* /
url('/ segoepr-webfont.ttf')格式('truetype'),/ * Safari,Android,iOS * /
url('/ segoepr-webfont.svg#svgFontName')format('svg'); / *传统的iOS * /
font-weight:normal;
font-style:normal;

$ / code>

我试过文件路径为/ fonts /,只是字体/无济于事。但是我不能让文件变成404,有人建议重新启动服务器,但是也没有达到任何效果。

有什么我失踪的?或者我犯了一些错误?



如果有帮助,我也在web.config中试过了这个。

 < staticContent> 
< remove fileExtension =。woff/>
< remove fileExtension =。ttf/>
< remove fileExtension =。eot/>
< remove fileExtension =。otf/>
< remove fileExtension =。svg/>
< / staticContent>


解决方案

以下是解决方案。参考 http://www.alienfactory.co。

 < / p> 

remove fileExtension =。woff/>
< remove fileExtension =。eot/>
< remove fileExtension =。ttf/>
< remove fileExtension =。svg/>


I am trying to get a font to render within a file and it is giving me the usual error of

Resource interpreted as Font but transferred with MIME type text/html:

But the HTML file on show is our 404.aspx file, I tried the usual of installing the applications in the web.config and then eventually into IIS itself as:

.woff  application/font-woff
.ttf   application/font-ttf
.eot   application/vnd.ms-fontobject
.otf   application/font-otf
.svg   image/svg+xml

I cannot understand where I am going wrong. the files are stored in a folder called fonts that is in the base directory for the site and I have the style within my aspx file as

@font-face {
    font-family: 'segoe_printregular';
    src: url('/fonts/segoepr-webfont.eot'); /* IE9 Compat Modes */
    src: url('/fonts/segoepr-webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/fonts/segoepr-webfont.woff') format('woff'), /* Modern Browsers */
         url('/fonts/segoepr-webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/fonts/segoepr-webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
    font-weight: normal;
    font-style: normal;
}

and the stylesheet.css within the fonts folder as:

@font-face {
    font-family: 'segoe_printregular';
    src: url('/segoepr-webfont.eot'); /* IE9 Compat Modes */
    src: url('/segoepr-webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('/segoepr-webfont.woff') format('woff'), /* Modern Browsers */
         url('/segoepr-webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('/segoepr-webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
    font-weight: normal;
    font-style: normal;
    }

I have tried the file paths as /fonts/ and just fonts/ to no avail. But I cannot get the file to bnot 404. Someone suggested restarting the server but that did not achieve anything either.

Is there anything I am missing? Or some mistake that I have made?

If it helps I also tried this in the web.config

<staticContent>
    <remove fileExtension=".woff" />
    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <remove fileExtension=".ttf" />
    <mimeMap fileExtension=".ttf" mimeType="application/font-ttf" />
    <remove fileExtension=".eot" />
    <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
    <remove fileExtension=".otf" />
    <mimeMap fileExtension=".otf" mimeType="application/font-otf" />
    <remove fileExtension=".svg" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>

解决方案

For those who need answer. Below is solution. Reference http://www.alienfactory.co.uk/articles/mime-types-for-web-fonts-in-bedsheet for details.

<remove fileExtension=".woff" />
<remove fileExtension=".eot" />
<remove fileExtension=".ttf" />
<remove fileExtension=".svg" />

<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".ttf" mimeType="application/font-sfnt" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />

这篇关于尽管在IIS中安装了woff,ttf,svg和eot 404的MIME类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆