HttpExceptions has been updated to version 2.3 for use with the new .NET Core 3.0.

Build Status NuGet Badge License: MIT


HttpExceptions lets you return exceptions over HTTP e.g. as ASP.NET Core Problem Details, and has HTTP-specific exception classes that enable ASP.NET to generate exception information.

Getting started

In ASP.NET Core 3.0 you add the HttpExceptions services and the middleware in the Startup.cs of your application. The change from 2.x to 3.0 is that you now add it to AddControllers() instead of to AddMvcCore().

public void ConfigureServices(IServiceCollection services)

Then you can add the HttpExceptions middleware using the application builder. UseHttpExceptions should be the first middleware component added to the pipeline. That way the UseHttpExceptions Middleware catches any exceptions that occur in later calls. When using HttpExceptions you don't need to use UseExceptionHandler or UseDeveloperExceptionPage.

public void Configure(IApplicationBuilder app)
    app.UseHttpExceptions(); // this is the first middleware component added to the pipeline

InvalidModelStateResponseFactory API behavior

From this release on HttpExceptions always overrides the default Microsoft.AspNetCore.Mvc.ApiBehaviorOptions.InvalidModelStateResponseFactory and related settings and will use the configured ExceptionMappers. The SuppressInvalidModelStateResponseFactoryOverride has been removed.

Where can I get it?

The code can be found on GitHub at: And there is also a sample project you can have a look at.

You can install the Opw.HttpExceptions and Opw.HttpExceptions.AspNetCore NuGet packages from the package manager console:

PM> Install-Package Opw.HttpExceptions
PM> Install-Package Opw.HttpExceptions.AspNetCore