如何使 otf 字体在纯 angular 站点上的 Azure 上工作
How to make otf fonts work on Azure on a pure angular site
我想在 Azure 上托管一个纯 angular 网站(不是 .Net)。我通过 FTP 上传了我的 Azure 文件夹中的必要文件。网站工作正常,除了字体。它无法加载 .otf 字体。由于我的网站不是 .Net,它甚至没有 web.config 文件。所以我创建了以下 web.config 文件以支持 .otf 文件类型:
<configuration>
<configSections>
</configSections>
<system.web>
<staticContent>
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
</staticContent>
</system.web>
</configuration>
在此之后,我开始收到以下错误消息:
The configuration section 'staticContent' cannot be read because it is missing a section declaration.
我试着在 <configSections>
部分这样声明它:
<sectionGroup name="system.webServer" type="System.WebServer.Configuration.SystemWebServerSectionGroup">
<section name="staticContent" type="System.WebServer.Configuration.StaticContentSection" overrideModeDefault="Deny" />
</sectionGroup>
现在我收到以下错误:
There is a duplicate 'system.webServer/staticContent' section defined
所以如果我不声明该部分,它就不起作用。如果我声明它,那么它就是重复的。我是不是遗漏了什么或者 Azure 在跟我开玩笑?
您是否尝试在您的网络配置中输入:...小心..它在 <system.webServer>
部分
<system.webServer>
<staticContent>
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
我想在 Azure 上托管一个纯 angular 网站(不是 .Net)。我通过 FTP 上传了我的 Azure 文件夹中的必要文件。网站工作正常,除了字体。它无法加载 .otf 字体。由于我的网站不是 .Net,它甚至没有 web.config 文件。所以我创建了以下 web.config 文件以支持 .otf 文件类型:
<configuration>
<configSections>
</configSections>
<system.web>
<staticContent>
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
</staticContent>
</system.web>
</configuration>
在此之后,我开始收到以下错误消息:
The configuration section 'staticContent' cannot be read because it is missing a section declaration.
我试着在 <configSections>
部分这样声明它:
<sectionGroup name="system.webServer" type="System.WebServer.Configuration.SystemWebServerSectionGroup">
<section name="staticContent" type="System.WebServer.Configuration.StaticContentSection" overrideModeDefault="Deny" />
</sectionGroup>
现在我收到以下错误:
There is a duplicate 'system.webServer/staticContent' section defined
所以如果我不声明该部分,它就不起作用。如果我声明它,那么它就是重复的。我是不是遗漏了什么或者 Azure 在跟我开玩笑?
您是否尝试在您的网络配置中输入:...小心..它在 <system.webServer>
部分
<system.webServer>
<staticContent>
<remove fileExtension=".otf" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>