Getting ready

We need to modify the code contained inside the Configure() method of our Startup class. It is here that we set up middleware in an ASP.NET Core application. In Chapter 10Exploring .NET Core 1.1, we saw that our Configure() method already contained two pieces of middleware. The first is a piece of middleware that will display a developer exception page when an unhandled exception is caught. The code looks as follows:

if (env.IsDevelopment()){   app.UseDeveloperExceptionPage();}

This will display any error messages which is useful for debugging the application. Typically, this page would contain information such as a stack trace. It is only installed when the application is in development mode. When you first create an ASP.NET ...

Get C# 7 and .NET Core Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.