c# - 运行Blazor网站时出现版式错误

标签 c# asp.net-core error-handling blazor circuit

我更新了Visual Studio 19,在此之前,我的网站完全按照我的预期运行。现在,我在加载主页时遇到错误,但是在完成加载之前就中断了。我在下面提供了错误代码。我还会让您知道,我已经看过这篇文章(How to turn on 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.

实现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; });

然后在此处发布结果。

关于c# - 运行Blazor网站时出现版式错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57593583/

相关文章:

c# - 如何更改 DateTime/GetLastWriteTime 的格式?

c# - 理解语言规范中描述的 C# 类型推断的问题

c# - .Net core 脚手架 dbcontext 失败,无法加载类型 'System.IO.File'

python - python 中的错误处理程序

c# - 从 "Text"中获取 "System.EventArgs objArgs"值

c# - Xamarin 固定导航栏

validation - 自定义 ASP.NET Core MVC 验证响应

docker - 将 ASP.NET 5 项目发布到 Docker 时找不到名称为 "Custom"的 AspnetPublishHandler

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

asp.net - 如何显示更好的错误然后:"A potentially dangerous Request.Form value was detected from the client"