Blazor wasm failed to start platform. Reason: TypeError: NetworkError when attempting to fetch resource

Blazor wasm failed to start platform. Reason: TypeError: NetworkError when attempting to fetch resource

我正在尝试发布我的 blazor wasm 项目。当我点击托管它的 url 时,应用程序永远不会加载,并且我在控制台中看到此错误:

Error: Failed to start platform. Reason: TypeError: NetworkError when attempting to fetch resource.
    g https://my-test-server.com/_framework/blazor.webassembly.js:1
    s https://my-test-server.com/_framework/blazor.webassembly.js:1
    s https://my-test-server.com/_framework/blazor.webassembly.js:1
    s https://my-test-server.com/_framework/blazor.webassembly.js:1
    promise callback*u https://my-test-server.com/_framework/blazor.webassembly.js:1
    a https://my-test-server.com/_framework/blazor.webassembly.js:1
    promise callback*u https://my-test-server.com/_framework/blazor.webassembly.js:1
    a https://my-test-server.com/_framework/blazor.webassembly.js:1
    promise callback*u https://my-test-server.com/_framework/blazor.webassembly.js:1
    r https://my-test-server.com/_framework/blazor.webassembly.js:1
    r https://my-test-server.com/_framework/blazor.webassembly.js:1
    g https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
    n https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
blazor.webassembly.js:1:14889
    printErr https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
    (Async: promise callback)
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
    n https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1
    <anonymous> https://my-test-server.com/_framework/blazor.webassembly.js:1

这个错误并没有真正让我继续下去......任何人都知道我什至可以从哪里开始寻找以试图弄清楚发生了什么?

我想通了 - 事实证明,当我安装 .NET 6 时,发布开始到 trim 程序集(即使我使用 VS2019 发布)。我不得不通过将其添加到我的 blazor csproj 来禁用它:

   <PropertyGroup>
      <PublishTrimmed>false</PublishTrimmed>
   </PropertyGroup>