Code Review: ASP.NET Core Request / Response logging middleware

preview_player
Показать описание
Code Review: ASP.NET Core Request / Response logging middleware

Рекомендации по теме
Комментарии
Автор

The one thing that stands out is all the string concatenation. That's killing performance and allocating like crazy. You can multiline strings in C#, but since you're already constructing a string builder for the headers, why not use a single builder for the whole request and ditch that FormatRequestAsync method. I see you're enabling buffering on the body. That is also a performance killer. Even if you want to log the request, you should be able to achieve this another way. Maybe dig into the Yarp code to see how their request forwarder works.

th_CAV_Trooper