gpt4 book ai didi

azure - 如何启用 Assets 文件夹的权限

转载 作者:行者123 更新时间:2023-12-03 02:50:20 24 4
gpt4 key购买 nike

我在网络应用程序(带有角度 cli 的 Angular 7)azure 上部署了我的项目,我可以看到它在我的网站上“工作”。问题是应用程序似乎无法访问 Assets 文件夹,所有请求都失败。

e {headers: t, status: 404, statusText: "Not Found", url: "https://<mysite>/assets/i18n/it.json", ok: false, …}
error: "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."
headers: t {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
message: "Http failure response for https://<mysite>/assets/i18n/it.json: 404 Not Found"
name: "HttpErrorResponse"
ok: false
status: 404
statusText: "Not Found"
url: "https://<mysite>/assets/i18n/it.json"

我改变的是虚拟路径

site\wwwroot

site\wwwroot\dist\<name of project>

添加以下设置:

"WEBSITE_NODE_DEFAULT_VERSION" "8.10.0" 
"SCM_COMMAND_IDLE_TIMEOUT" "1800"

如果我使用控制台导航到该文件夹​​,则该文件夹存在,但如果我通过浏览器导航到该文件夹​​,则响应为:

"You do not have permission to view this directory or page."

该文件也存在,但给我错误:

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

我什至尝试将 Assets 文件夹添加为“虚拟应用程序和目录”中的目录:

VIRTUAL PATH    PHYSICAL PATH                             TYPE  
/ site\wwwroot\dist\mysite Application
/assets site\wwwroot\dist\mysite\assets Directory

但它并没有改变任何东西

你能帮我吗?

最佳答案

这似乎是Azure WebApp的常见问题,默认不支持静态json文件。要修复此问题,您需要将 json 的 mimetype 设置添加到 web.conf。请引用我对其他类似SO线程的回答Getting "404 not found" on doing a GET on local file in Azure web app .

以下是 web.confmimetype 设置示例。

<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
</configuration>

希望有帮助。

关于azure - 如何启用 Assets 文件夹的权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56426132/

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