MadEyeMatt.AspNetCore.ProblemDetails
9.0.0
dotnet add package MadEyeMatt.AspNetCore.ProblemDetails --version 9.0.0
NuGet\Install-Package MadEyeMatt.AspNetCore.ProblemDetails -Version 9.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MadEyeMatt.AspNetCore.ProblemDetails" Version="9.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MadEyeMatt.AspNetCore.ProblemDetails --version 9.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MadEyeMatt.AspNetCore.ProblemDetails, 9.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MadEyeMatt.AspNetCore.ProblemDetails as a Cake Addin #addin nuget:?package=MadEyeMatt.AspNetCore.ProblemDetails&version=9.0.0 // Install MadEyeMatt.AspNetCore.ProblemDetails as a Cake Tool #tool nuget:?package=MadEyeMatt.AspNetCore.ProblemDetails&version=9.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AspNetCore.ProblemDetails
A middleware to create RFC 7807 problem details for APIs.
Usage
To configute the mandatory services for the problem details middleware just execute
AddProblemDetails
on the IMvcBuilder
instance in your startup code.
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services
.AddControllers()
.AddProblemDetails(options =>
{
// Only include exception details in a development environment. This is the default
// behavior and is included to demo purposes.
options.IncludeExceptionDetails = (context, exception) => builder.Environment.IsDevelopment();
// Use the status code 501 for this type of exception.
options.MapStatusCode<NotImplementedException>(HttpStatusCode.NotImplemented);
// Use the status code 501 for this type of exception.
options.MapStatusCode<InvalidOperationException>(HttpStatusCode.InternalServerError);
// Add a fallback for all other exceptions with the status code 500.
options.MapStatusCode<Exception>(HttpStatusCode.InternalServerError);
});
After you've built your web application instance add the middlware to the pipeline by
calling UseProblemDetails
.
WebApplication app = builder.Build();
// Configure the HTTP request pipeline.
app.UseCors();
app.UseProblemDetails();
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- No dependencies.
-
net9.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MadEyeMatt.AspNetCore.ProblemDetails:
Package | Downloads |
---|---|
Fluxera.Extensions.Hosting.Modules.AspNetCore.HttpApi
A module that enables HTTP APIs for ASP.NET Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
9.0.0 | 108 | 11/14/2024 |
8.0.6 | 108 | 11/1/2024 |
8.0.5 | 106 | 7/9/2024 |
8.0.4 | 203 | 5/23/2024 |
8.0.3 | 431 | 4/18/2024 |
8.0.2 | 249 | 3/19/2024 |
8.0.1 | 706 | 11/24/2023 |
8.0.0 | 209 | 11/16/2023 |
7.2.0 | 610 | 3/22/2023 |
7.1.0 | 545 | 1/18/2023 |
7.0.0 | 722 | 11/20/2022 |
6.2.0 | 657 | 10/12/2022 |
6.1.1 | 1,808 | 6/7/2022 |
6.1.0 | 424 | 6/4/2022 |
6.0.1 | 444 | 5/10/2022 |
6.0.0 | 436 | 5/7/2022 |