gpt4 book ai didi

asp.net-mvc - 部署到 azure 时图形丢失

转载 作者:行者123 更新时间:2023-12-03 03:15:11 25 4
gpt4 key购买 nike

我刚刚将我的第一个 MVC5 应用程序部署到 azure,并且一切正常,只是它不显示图形。在我的开发机器上,这是有效的。

我的图形位于文件夹 ~/Content/Graphics 中,这是引用其中一个的 _Layout.cshtml 的一部分,

<img src="@Url.Content("~/content/graphics/EluciusSoft_Logo.svg")" style="height:50px">

不过,我知道这些文件位于服务器上,因为我使用 WebMatrix 检查了它。为什么他们不显示?

编辑:浏览器控制台错误消息如下:

Failed to load resource: the server responded with a status of 404 (Not Found)

这是使用 WebMatrix 的站点目录的屏幕截图。

Folder Screenshot

最佳答案

如果网络服务器尚未配置 SVG 的 MIME 类型,那么当您尝试访问它时,它将返回 404 错误。您可以在应用程序的 web.config 中定义 MIME 类型:

<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
</staticContent>
</system.webServer>
</configuration>

关于asp.net-mvc - 部署到 azure 时图形丢失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29149226/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com