当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net mvc - Custom css font display with interference after publishing site to Azure

问题描述:

Trying to post web-site at different hostings (somee.com, azure, localhost). Site at asp.net mvc 4.

Displaying at the localhost and somee.com:

https://dl.dropboxusercontent.com/u/58930284/testing/font_local.png

At the Azure Web site:

https://dl.dropboxusercontent.com/u/58930284/testing/font_azure.png

css:

@font-face

{

font-family: 'Font name';

src: url("fonts/Font name.eot");

src: url("fonts/Font name.eot?#iefix") format("embedded-opentype"),

url("fonts/Font name.woff") format("woff"),

url("fonts/Font name.ttf") format("truetype"),

url("fonts/Font name.svg") format("svg");

font-weight: normal;

font-style: normal;

}

网友答案:

IIS 7 will not return file types that are not added to the element or that have mappings in the element by default. This behavior prevents unauthorized access to files that do not have mappings in the IIS 7 configuration settings.

Basically, IIS does not return static files that it does not know about its media type. Therefore, you need to add unknown mime types manually.

<configuration>
   <system.webServer>
       <staticContent>
         <remove fileExtension=".svg" />
         <remove fileExtension=".eot" />
         <remove fileExtension=".woff" />
         <mimeMap fileExtension=".svg" mimeType="image/svg+xml"  />
         <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
         <mimeMap fileExtension=".woff" mimeType="application/x-woff" />
       </staticContent>
   </system.webServer>
</configuration>

Place this configuration to webconfig file in your project.

分享给朋友:
您可能感兴趣的文章:
随机阅读: