How to log automatic 400 responses (#12315)
* How to log automatic 400 responses * change link-to-issue formatpull/12320/head
parent
372011ecf3
commit
d309fe4fa8
|
@ -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`:
|
||||
|
|
Loading…
Reference in New Issue