运行 Blazor 网站时出现格式布局错误

I have a formlayout error when running a Blazor website

我更新了 visual studio 19 和之前我的网站 运行 完全符合我的预期。现在我在加载主页时遇到错误,但在它完成加载之前就中断了。我在下面提供了错误代码。我也会让你知道我已经看到了这个 post ( ) 并尝试了所有但没有奏效。

Information: Normalizing '_blazor' to 
'http://fakesite.com/_blazor'.

Error: There was an unhandled exception on the current circuit, so this 
circuit will be terminated. For more details turn on detailed exceptions in 
'CircuitOptions.DetailedErrors'

Information: Connection disconnected.

实施 Hanks 解决方案后出现新错误

Error: Microsoft.JSInterop.JSException: Could not find 'FormLayout' in 'window.DxBlazor'.
Error: Could not find 'FormLayout' in 'window.DxBlazor'.
    at http://fakesite.com/_framework/blazor.server.js:8:27768
    at Array.forEach (<anonymous>)
    at d (http://fakesite.com/_framework/blazor.server.js:8:27729)
    at http://fakesite.com/_framework/blazor.server.js:8:28342
    at new Promise (<anonymous>)
    at e.beginInvokeJSFromDotNet (http://fakesite.com/_framework/blazor.server.js:8:28316)
    at http://fakesite.com/_framework/blazor.server.js:1:19148
    at Array.forEach (<anonymous>)
    at e.invokeClientMethod (http://fakesite.com/_framework/blazor.server.js:1:19119)
    at e.processIncomingData (http://fakesite.com/_framework/blazor.server.js:1:17165)
   at Microsoft.JSInterop.JSRuntimeBase.InvokeWithDefaultCancellation[T](String identifier, IEnumerable`1 args)
   at Microsoft.AspNetCore.Components.Rendering.Renderer.GetErrorHandledTask(Task taskToHandle)

这是 CreateWebHostBuilder 方法

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
     WebHost.CreateDefaultBuilder(args)
     .UseSetting(WebHostDefaults.DetailedErrorsKey, "true")
     .CaptureStartupErrors(true)
     .UseStartup<Startup>();

从字面上理解建议开始。

在Startup.ConfigureServices中:

services
  .AddServerSideBlazor()
  .AddCircuitOptions(options => { options.DetailedErrors = true; });

然后 post 结果在这里。

Visual Studio 更新后,我的所有 NuGet 包也进行了更新。这包括用于 Blazor NuGet 包的 DevExpress,通过该更新,他们将 link 更改为 dx-blazor.js 和 dx-blazor.css 文件,您应该将它们放在布局的 HEAD 部分。

发件人:

<link href="lib/dx-blazor.css" rel="stylesheet" />
<script src="lib/dx-blazor.js"></script>

收件人:

<link href="lib/dx-blazor/dx-blazor.css" rel="stylesheet" />
<script src="lib/dx-blazor/dx-blazor.js"></script>

希望这可能对处于我的情况或与我类似的情况的其他人有所帮助。

看来这个问题与客户端脚本有关。如果您在消息中看到 "window.DxBlazor",这意味着您需要在客户端脚本中查找原因。请确保您的项目中包含最新的 DevExpress 脚本。 请参阅 How to create a new project 段的第 6 项。