尝试使用.net 7 Mvc 创建 PWA 但收到 ArgumentNullException 参数路径值不能为空

问题描述 投票:0回答:0

我已经按照 Microsoft 文档中的说明创建了 PWA 应用程序通过添加 nu get 包 WebEssentials.AspNetCore.PWA,然后我创建了一个包含相关字段的 manifest.json

我还将引用的图像添加到图像文件夹中

manifest.json

{
  "name": "PWADemo",
  "short_name": "PWA",
  "description": "Demo PWA application in ASP.NET Core.",
  "icons": [
    {
      "src": "/images/icon 192x192.png",
      "sizes": "192x192",
      "type": "image/png"
    },
    {
      "src": "/images/icon 512x512.png",
      "type": "image/png",
      "sizes": "512x512"
    }
  ],
  "display": "standalone",
  "start_url": "/"
} 

然后我将其添加到program.cs IServiceCollection

程序.cs

builder.Services.AddMvc();

builder.Services.AddProgressiveWebApp(new PwaOptions { RegisterServiceWorker = true });

当我运行应用程序时,我收到此错误屏幕

我已经用谷歌搜索过这个,但似乎没有答案与我的具体情况相关

我不确定我需要更改什么才能使其正常工作

希望有人能指出我正确的方向

.net model-view-controller progressive-web-apps core
© www.soinside.com 2019 - 2024. All rights reserved.