RequestCounter custom middleware asp.net core
public class RequestCounter
{
public static int requestCount=0;
RequestDelegate _next;
public RequestCounter(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
requestCount++;
await _next.Invoke(context);
}
}