How to log automatic 400 responses (#12315)

* How to log automatic 400 responses

* change link-to-issue format
pull/12320/head
Tom Dykstra 2019-05-07 08:49:01 -07:00 committed by GitHub
parent 372011ecf3
commit d309fe4fa8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,7 @@ description: Learn the basics of creating a web API in ASP.NET Core.
monikerRange: '>= aspnetcore-2.1'
ms.author: scaddie
ms.custom: mvc
ms.date: 04/11/2019
ms.date: 05/07/2019
uid: web-api/index
---
@ -133,6 +133,10 @@ To customize the response that results from a validation error, use <xref:Micros
[!code-csharp[](index/samples/2.x/Startup.cs?name=snippet_ConfigureBadRequestResponse&highlight=3-20)]
### Log automatic 400 responses
See [How to log automatic 400 responses on model validation errors (aspnet/AspNetCore.Docs #12157)](https://github.com/aspnet/AspNetCore.Docs/issues/12157).
### Disable automatic 400
To disable the automatic 400 behavior, set the <xref:Microsoft.AspNetCore.Mvc.ApiBehaviorOptions.SuppressModelStateInvalidFilter> property to `true`. Add the following highlighted code in `Startup.ConfigureServices` after `services.AddMvc().SetCompatibilityVersion`: