【发布时间】:2022-08-23 23:16:13
【问题描述】:
我有一个 .Net 6 Blazor 服务器端应用程序。 应用程序出现错误
错误:当前电路存在未处理的异常,因此该电路将被终止。有关更多详细信息,请通过在 \'appSettings.Development.json\' 中设置 \'DetailedErrors: true\' 或设置 \'CircuitOptions.DetailedErrors\' 来打开详细异常。
我尝试设置 CircuitOptions.DetailedErrors = true。
我确保我处于调试模式,即 Environment.IsDevelopment 开关设置为 true。
程序.cs
if (builder.Environment.IsDevelopment()) { builder.Services.AddServerSideBlazor().AddCircuitOptions(x => x.DetailedErrors = true); } else { builder.Services.AddServerSideBlazor(); }我在 appSettings.Developmnet.json 和 appSettings.json 中设置了 \'DetailedErrors: true\'。
\"AppSettings\": { \"DetailedErrors\": true,但是,这无论如何都不会影响错误消息。
我仍然无法获得详细的错误消息。
关于还有什么可以尝试的任何想法?
-
builder.Services.AddServerSideBlazor(options => { options.DetailedErrors = true; options.DisconnectedCircuitMaxRetained = 100; options.DisconnectedCircuitRetentionPeriod = TimeSpan.FromMinutes(3); options.JSInteropDefaultCallTimeout = TimeSpan.FromMinutes(1); options.MaxBufferedUnacknowledgedRenderBatches = 10; }) .AddCircuitOptions(opt => {opt.DetailedErrors = true;});
-
这就是我为 .Net6 Blazor 服务器端项目所做的。
-
我已经使用了您的示例,但没有任何更改。我想在发布时检查 program.cs 文件是否正在上传。我注意到这个文件不在发布目录中。你知道我会在哪里找到在 program.cs 文件中设置的开关/设置吗?
-
好的,检查发布文件夹是否有 \'appsettings.production.json\' 文件,并确保启用了您的设置。
-
它正在添加让它工作的 appsettings.production.json 文件。太感谢了!请务必提交答案,以便我给你信用。 :-)
标签: blazor-server-side .net-6.0