Angular不提供manifest.webmanifest [英] Angular not serving manifest.webmanifest

查看:93
本文介绍了Angular不提供manifest.webmanifest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Angular 10应用中,我将其发布到Azure,并且可以正常加载.

但是,当我转到

我猜测文件类型"webmanifest"为是问题吗?Azure不会提供服务吗?

解决方案

在将Angular Pwa发布到Azure时,我遇到了类似的问题.找不到网络清单.要修复它,我必须使用以下代码将web.config文件添加到dist文件夹中:

 <?xml version ="1.0"encoding ="UTF-8"?<配置>< system.webServer>< staticContent>< mimeMap fileExtension =.json"mimeType ="application/json"/>< mimeMap fileExtension =.webmanifest"mimeType ="application/json"/></staticContent></system.webServer></configuration> 

In my Angular 10 app, I publish it to Azure and it loads fine.

However, the manifest.webmanifest is not being served when I go to https://THESITE.azurewebsites.net/manifest.webmanifest, I get:

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

Other files like the Robots.txt serve fine.

My Angular.json has:

"outputPath": "dist/",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "aot": true,
        "assets": [
          "src/favicon.ico",
          "src/assets",
          "src/robots.txt",
          "src/manifest.webmanifest"
        ],

And in the Azure App Service Editor, I can see it:

I am guessing that the file type "webmanifest" is the issue? Azure won't serve it?

解决方案

I had a similar problem when publishing an Angular Pwa to Azure. The webmanifest wasn't found. To fix it i had to add a web.config file to the dist folder with this code:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".json" mimeType="application/json" />
            <mimeMap fileExtension=".webmanifest" mimeType="application/json" />
        </staticContent>
     </system.webServer>
</configuration>

这篇关于Angular不提供manifest.webmanifest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆