部署在 azure web 应用程序上时找不到 React 应用程序上的字体

发布于 2025-01-14 09:55:38 字数 1445 浏览 3 评论 0原文

我从早上起就一直在尝试在天蓝色上部署我的简单反应应用程序,除了字体之外,所有内容都加载得很完美! 控制台中得到的内容

 Failed to load resource: the server responded with a status of 404 (Not Found)
 CircularStd-Bold.5c4514a8399ec0064b9b.otf

这是我在访问字体链接时在

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

我得到一个包含以下错误的页面我阅读了数千篇文章我确实将我的 web.config 文件添加到公共文件夹中,代码如下:

<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="React Routes" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/" />
                </rule>
            </rules>
        </rewrite>
        <staticContent>
             <mimeMap fileExtension=".otf" mimeType="font/otf" />
        </staticContent>
    </system.webServer>
</configuration>

我在做什么请问错了吗?

I've been trying since the morning to deploy my simple react app on azure, everything is loaded perfectly except the FONTS !
here's what i get in the console

 Failed to load resource: the server responded with a status of 404 (Not Found)
 CircularStd-Bold.5c4514a8399ec0064b9b.otf

when i access the link of the font i get a page with the following error

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

i read thousands of articles i did add my web.config file to the public folder, with the following code :

<?xml version="1.0"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="React Routes" stopProcessing="true">
                    <match url=".*" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="/" />
                </rule>
            </rules>
        </rewrite>
        <staticContent>
             <mimeMap fileExtension=".otf" mimeType="font/otf" />
        </staticContent>
    </system.webServer>
</configuration>

WHAT AM I DOING WRONG PLEASE?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放手` 2025-01-21 09:55:38

输入图片这里的描述

这是添加 webconfig 文件和静态文件中存在的字体后的 wwwroot 文件夹

在此处输入图像描述

enter image description here

Here's an the wwwroot folder after adding the webconfig file and the fonts present in the static file

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文