Preventing a screen of death

There is a simple solution that will prevent your application from producing a screen of death, and that is to simply make sure that you configure and specify a custom error page. Luckily, ASP.NET Core 3 provides ready-made plumbing for you to achieve that through middleware in the Startup class.

It's not a nice experience on the part of the user to see a screen of death. It is better to think of your user and give them a friendly error page when something goes wrong.

You can specify the custom error page in the Startup class of the Configure method:

if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}

This determines what kind of error page will be shown to the user according to the environment, whether it is a development or other kind of environment, including production.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.239.118