How to turn on CircuitOptions.DetailedErrors?

后端 未结 3 1861
耶瑟儿~
耶瑟儿~ 2021-02-12 00:43

I\'m getting this message in the console when running a server-side Blazor app:

Error: There was an unhandled exception on the current circuit, so this

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-12 01:19

    A better way to add detailed errors is to check your environment first. In Startup.cs add IWebHostEnvironment env to your constructor.

    Then you can do this:

    services.AddServerSideBlazor().AddCircuitOptions(o =>
    {
        if (_env.IsDevelopment()) //only add details when debugging
        {
            o.DetailedErrors = true;
        }
    });
    

提交回复
热议问题