为 ASP.NET 中的 manifest.json GCM 推送通知获取未经授权的 401

Getting Unauthorized 401 for manifest.json GCM push notifications in ASP.NET

我的清单文件在根文件夹中,在 _Layout 视图中引用如下:

<link rel="manifest" href="~/manifest.json">

文件结构如下:

{
"gcm_sender_id": "MY_Sender_Id",
"permissions": [
"gcm"
] 
}

在应用程序选项卡下的 chrome 开发工具中,不断获得 401 未授权,这是我得到的:

使用 FCM for Web 时,gcm_sender_id 的值是固定的。来自 docs:

{
  "//": "Some browsers will use this to enable push notifications.",
  "//": "It is the same for all projects, this is not your project's sender ID",
  "gcm_sender_id": "103953800507"
}

Don't confuse the "browser sender ID" with the project-specific sender ID value shown in your Firebase project settings. The browser sender ID for manifest.json is a fixed value, common among all FCM JavaScript clients.