【发布时间】:2020-07-12 05:08:16
【问题描述】:
我正在运行一个 Azure webapp,我将在其中调用 JSON 文件,但是当我尝试加载该文件时,我得到一个 404.17。我已经尝试更新here 概述的 web.config,但是当我这样做时,web.config 会杀死我的网站,然后根本没有加载任何内容。我得到的错误The page cannot be displayed because an internal server error has occurred.
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".woff" />
<remove fileExtension=".woff2" />
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
</staticContent>
</system.webServer>
</configuration>
我还尝试了以下方法,这也导致网站瘫痪。
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>
【问题讨论】:
-
对于您的第二个 sn-p,请先尝试使用
删除 .json 的 mimeMap,然后再尝试设置它。另外,通过“关闭网站”,您具体看到了什么错误? -
出现内部服务器错误,无法显示页面。
-
@RobReagan 谢谢!我补充说,它似乎修复了网站出现故障,但仍然收到
The requested content appears to be script and will not be served by the static file handler错误。 -
这个 ASP.NET MVC 是在 Net Framework 还是 Net Core 下运行的?
-
@RobReagan 这是.Net Core
标签: azure web-applications azure-webapps