【问题标题】:404 Error on .woff, .woff2 and .ttf fonts for a React application deployed in a production shared IIS host部署在生产共享 IIS 主机中的 React 应用程序的 .woff、.woff2 和 .ttf 字体出现 404 错误
【发布时间】:2022-01-13 22:55:57
【问题描述】:

这些 mimetype 最初已存在于 IIS 设置中。

我也尝试在 web.config 文件中添加 mimetypes,但仍然无法正常工作。

<staticContent>
  <remove fileExtension=".woff" />
  <remove fileExtension=".woff2" />
  <remove fileExtension=".ttf" />
  <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
  <mimeMap fileExtension=".woff2" mimeType="font/x-woff" />
  <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
</staticContent>

我也尝试添加请求过滤,但仍然无法正常工作。

<security>
    <requestFiltering>
        <fileExtensions>
            <add fileExtension=".woff" allowed="true" />
            <add fileExtension=".ttf" allowed="true" />
            <add fileExtension=".woff2" allowed="true" />
        </fileExtensions>
    </requestFiltering>
</security>

感谢您的帮助。谢谢各位!

【问题讨论】:

    标签: reactjs iis http-status-code-404 font-awesome shared-hosting


    【解决方案1】:

    也有可能是 URL 中请求的文件位置不正确,请确认浏览器 URL 中请求的文件存在于 IIS 计算机上,并且位置正确。

    您可以使用 IIS Microsoft 管理控制台 (MMC) 管理单元来确定所请求的文件必须存在于 IIS 计算机的文件系统中的什么位置。

    更多信息可以参考这个链接:https://docs.microsoft.com/en-US/troubleshoot/iis/troubleshoot-404-file-not-found-error#resolution。

    【讨论】:

    • 很遗憾,我无法访问 IIS 计算机。我已经尝试将这些文件复制到根目录和几乎所有子文件夹,但仍然无法正常工作。
    • 很遗憾,您的问题未经许可很难解决。
    猜你喜欢
    • 2016-04-10
    • 2021-02-27
    • 2016-10-20
    • 2016-09-29
    • 1970-01-01
    • 2017-06-05
    • 2020-07-17
    • 1970-01-01
    • 2016-01-13
    相关资源
    最近更新 更多