[英]How to publish a font to Azure Web Apps?
How do I publish a Font Awesome library to a Azure Web App service?如何将 Font Awesome 库发布到 Azure Web App 服务?
I'm using Visual Studio 2019 and .NET Framework 4.8我正在使用 Visual Studio 2019 和 .NET Framework 4.8
Either the library is not getting published, or it is not accessible.该库未发布,或者无法访问。
I get an error in the browser console:我在浏览器控制台中收到错误消息:
"downloadable font: download failed (font-family: "Font Awesome 5 Free" style:normal weight:900 stretch:100 src index:1): status=2147746065 source: <my-url>/fontawesome513/webfonts/fa-solid-900.woff2"
“可下载字体:下载失败(字体系列:“Font Awesome 5 Free”样式:正常重量:900 stretch:100 src index:1):status = 2147746065 来源:<my-url>/fontawesome513/webfonts/fa-solid -900.woff2"
This question has basically been asked here . 这里基本上已经问过这个问题了。 However, the accepted answer seems to be flawed and out-of-date.
但是,接受的答案似乎有缺陷且已过时。 See my reasoning at the bottom of this post.
请参阅本文底部的推理。
Does the custom font limitation for PDF generation (mentioned in the other post's answer) apply to web apps, in general? PDF 代的自定义字体限制(在其他帖子的回答中提到)是否一般适用于 web 应用程序?
If not, any insight into how to publish a font to an Azure Web App?如果没有,是否了解如何将字体发布到 Azure Web 应用程序?
It seems hard to believe that publishing and using font libraries is not allowed for a Web App on Azure.很难相信Azure上的Web App不允许发布和使用字体库。
Reasoning for creating this question: The accepted answer points to a specific process of PDF generation: "Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered..." (source: Azure Web App sandbox , at the bottom of the page).创建此问题的原因:接受的答案指向 PDF 生成的特定过程:“Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered...”(来源: Azure 88763657905,88 App sandbox页面底部)。 The answer's " custom font " link redirects to non-custom-font tutorial and the " feeback post " link gives a "Page Not Found" error.
答案的“ 自定义字体”链接重定向到非自定义字体教程,“ 反馈帖子”链接给出“找不到页面”错误。
In light of this, it seems that an update to the existing question needs to occur, or a new question submitted.鉴于此,似乎需要对现有问题进行更新,或者提交新问题。 Thus this question (and I don't have enough rep to post a comment in the other question).
因此这个问题(我没有足够的代表在另一个问题中发表评论)。
Build Action
property is set to Content
for font all the files.Build Action
属性都设置为Content
。web.config
web.config
中添加以下代码段If you do not have a web.config
file create one.如果您没有
web.config
文件,请创建一个。
<system.webServer>
<staticContent>
<remove fileExtension=".svg" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<remove fileExtension=".eot" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<remove fileExtension=".woff" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
</staticContent>
</system.webServer>
web.config
is deployed and is under root directory after deployment.web.config
已部署,部署后位于根目录下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.