Can't get rid of missing manifest.json error

Sam*_*Sam 7 google-chrome visual-studio reactjs asp.net-core manifest.json

I'm building an ASP.NET Core app with ReactJs front-end in Visual Studio 2017.

Recently, I started to notice the missing manifest.json error in the console -- see below. It doesn't seem to effect my app but I do want to get rid of this error. 在此处输入图片说明

If I view my app in Edge, I don't see the missing manifest.json error so this error seems to be contained to Chrome only.

I published the app to Azure and again, in Chrome, I'm getting the same error but not in Edge.

知道我该如何解决吗?

Jon*_*ell 17

manifest.json 文件可能位于它应该在的位置。解决方案是在 .json 文件的静态内容部分下的 web.config 文件中添加一个条目。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.webServer>
    <staticContent>
      <mimeMap fileExtension=".json" mimeType="application/json" />
  </staticContent>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)

如果您需要添加或编辑您的 web.config 文件,您可以使用Kudu 调试控制台来完成(在链接中将 yourapp 替换为您的应用程序)

您还可以从应用程序开发工具下的门户启动调试控制台: 在此处输入图片说明

如果 manifest.json 文件确实丢失,您可以按照Google 添加 manifest.json 文件的说明进行修复

Chrome 需要 Web App Manifest 才能在 Web 应用程序中启用“添加到主屏幕”提示。

  • 这应该是公认的答案。我在这件事上犹豫了一段时间。文件在那里,头部的链接标签在那里,但没有被应用。我查看了权限,但没有成功。这,这才是正确答案!谢谢! (3认同)

Nko*_*osi 5

manifest.json文件/资源​​本身不存在,最有可能在项目中引用了某个地方。

检查是否有任何linkrel=manifest相似的标签

<link rel="manifest" href="/manifest.webmanifest">
Run Code Online (Sandbox Code Playgroud)

.webmanifest扩展名是在规范的“ 媒体类型注册”部分中指定的,但浏览器通常支持带有的其他合适扩展名的清单.json

<link rel="manifest" href="/manifest.json">
Run Code Online (Sandbox Code Playgroud)

并将其从代码中删除以停止错误。

参考Web App清单

  • 刚刚接受了你的回答。在接下来的 21 小时内,您还将获得 50 点奖励积分。我喜欢当其他人给你通用的答复,但随后像你这样的人出现并真正参与到这个问题并提供帮助。您的奖励积分是您应得的!再次感谢! (4认同)

Nik*_*kiy 5

只需添加crossorigin="use-credentials",它看起来像: <link rel="manifest" href="/site.webmanifest" crossorigin="use-credentials">