为什么在 ASP.NET Core 2.2 中自动发送 400 响应中的 traceid

Why is traceid sent in automatic 400 responses in ASP.NET Core 2.2

ASP.NET Core 2.2 为未通过模型绑定和验证的操作发送 automatic 400 responses

结果如下:

{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "Bad Request",
  "status": 400,
  "traceId": "xyz:xyz"
}

什么是traceId,为什么要发送给客户端?

来自@ChrisPratt 上面的评论:

The trace id should be the value of HttpContext.TraceIdentifier which is used to uniquely identify the request in things like logs. In short, you should be able to look up the value of traceId in your logs to potentially find out more information about why it was a "bad request". That of course assumes that you're logging at all and logging well, and it's also only of benefit to you as a developer and not the end-client. But they can share that with you if you're handling a trouble ticket, for example.