Middleware that captures synchronous and asynchronous exceptions from the pipeline and generates text error responses.
The ASP.NET Core DeveloperExceptionPageMiddleware
generates HTML error responses which are less helpful in a Web API
project accessed via a REST client. This middleware instead returns error responses in plain text that is easier to
read.
Install the NuGet package into your application.
Install-Package DeveloperExceptionText
dotnet add package DeveloperExceptionText
Add the following to the Configure
method in the Startup
class.
if (env.IsDevelopment())
{
app.UseDeveloperExceptionText();
}
Put UseDeveloperExceptionText
before any middleware you want to catch exceptions in, such as app.UseMvc
.