首页 > 解决方案 > 运行 Blazor 网站时出现表单布局错误

问题描述

我更新了 Visual Studio 19,在此之前我的网站完全按照我的预期运行。现在,当我加载主页时出现错误,但在它完成加载之前就中断了。我在下面提供了错误代码。我也想让你知道我已经看过这篇文章(如何打开 CircuitOptions.DetailedErrors?)并尝试了所有方法,但没有奏效。

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.

实施汉克斯解决方案后的新错误

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>();

标签: c#asp.net-coreerror-handlingblazorcircuit

解决方案


从字面上接受建议开始。

在 Startup.ConfigureServices 中:

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

然后在这里发布结果。


推荐阅读