c# - 运行 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>();
解决方案
从字面上接受建议开始。
在 Startup.ConfigureServices 中:
services
.AddServerSideBlazor()
.AddCircuitOptions(options => { options.DetailedErrors = true; });
然后在这里发布结果。
推荐阅读
- r - 从多页PDF到DataFrame R
- swiftui - 根据@State 变量的值变化重新加载视图
- c# - 运行寻路代码时Unity中的无限循环
- javascript - 提交后如何关闭引导模式?
- ios - 使用 GitHub Actions 构建 iOS React Native 应用程序
- javascript - 不要在 html 中按下按钮获得价值
- python - 如何访问包含实例成员的python静态方法?
- docker - 在 Dokku 中使用 Dockerized Vue 应用程序获取环境变量
- spring-boot - 启用 Spring webclient 以通过 HTTPS 与其他启用 TLS 的服务进行通信
- python - 使用 zip() 后删除重复列表