asp.net - Azure 上的静态内容(svg、woff、ttf)出现 404

标签 asp.net asp.net-mvc azure web-config

我正在尝试将 bootstrap glyphicons-halflings-regular.svg 添加到我的网站。在本地一切正常,但在 Azue 上我遇到 404 错误:

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

或者当我将以下 staticContent 部分添加到我的 web.config

<staticContent>
    <remove fileExtension=".woff" />
    <mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
    <remove fileExtension=".ttf" />
    <mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
    <remove fileExtension=".svg" />
    <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>

我收到此错误:

The controller for path '/Content/fonts/glyphicons-halflings-regular.woff' was not found or does not implement IController.

我应该如何正确配置我的 ASP.NET 站点以避免上述错误?

最佳答案

我在 .woff 文件中遇到了同样的问题。将该扩展添加到 web.config 的解决方案工作正常:

<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension="woff" mimeType="application/font-woff" />
  </staticContent>
</system.webServer>

(参见原始解决方案:http://www.codepal.co.uk/show/WOFF_files_return_404_in_Azure_Web_Sites)

关于asp.net - Azure 上的静态内容(svg、woff、ttf)出现 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18897079/

相关文章:

c# - String.Contains() 比 String.IndexOf() 快吗?

c# - 更新 Sharepoint 列表项

c# - MVC 部分发布页面 - 模型绑定(bind)失败

c# - 如何在 HTML 中为 ASP.NET MVC 创建按钮?

php - Azure PHP 联系表单通过电子邮件发送问题

asp.net - 如何避免使用代理类的 Web 方法参数?

asp.net - 如何处理ASP.NET应用程序启动时出现的错误以及MVC View 中的传输和显示错误?

sql-server - 在 Azure DevOps 中构建 SSIS 项目时出现 System.ArgumentException。在本地工作

azure - 为什么无法在特定区域创建 Azure 存储?

c# - 使用 PLINQ 时创建线程安全变量