这是托管网址:https://serviceworkerspike.azurewebsites.net/
我正在使用Vuejs创建PWA作为学校项目,每当我使用Azure托管网站时,都会发生这种情况,我在本地主机上就没有问题了... Chrome devtools对此回应:
/manifest.json:1 Failed to load resource: the server responded with a status of 404 ()
/manifest.json:1 Manifest: Line: 1,column: 1,Syntax error.
manifest.json:1 GET https://serviceworkerspike.azurewebsites.net/manifest.json 404
manifest.json:1 Manifest: Line: 1,Syntax error.
我在index.html中添加了它:
<link rel="manifest" href="/manifest.json">
这是我的manifest.json文件:
{
"name": "MessageBoardUCN","short_name": "MessageBoardUCN","theme_color": "#ff095a","background_color": "#feaaee","display": "standalone","start_url": "/index.html","icons": [
{
"src": "images/icons/icon-72x72.png","sizes": "72x72","type": "image/png"
},{
"src": "images/icons/icon-96x96.png","sizes": "96x96",{
"src": "images/icons/icon-128x128.png","sizes": "128x128",{
"src": "images/icons/icon-144x144.png","sizes": "144x144",{
"src": "images/icons/icon-152x152.png","sizes": "152x152",{
"src": "images/icons/icon-192x192.png","sizes": "192x192",{
"src": "images/icons/icon-384x384.png","sizes": "384x384",{
"src": "images/icons/icon-512x512.png","sizes": "512x512","type": "image/png"
}
],"splash_pages": null
}
-
我试图做如下的name和shortname属性:“ messageboarducn”
-
我还尝试将起始网址编辑为托管网址:“ https://serviceworkerspike.azurewebsites.net/”和“ /”
-
我也尝试过将manifest.json文件移到根目录和/ src目录中,但是其他指南告诉我,它应该与index.html位于同一文件夹中,并且/ public是默认的
通常您没有Vuejs的web.config文件,但我什至尝试添加一个如下所示的文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.webServer>
<staticContent>
<remove fileExtension=".json" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" />
</staticContent>
</system.webServer>
</configuration>
我该如何纠正错误?