Answer the question
In order to leave comments, you need to log in
Why is app.Use being called multiple times (ASP.NET Core)?
I have this code in the Configure method of the Startup class (Empty template project):
int x = 1;
app.Use(async (context, next) => {
if (x % 2 != 0)
{
await next.Invoke();
}
await context.Response.WriteAsync($"Res: {x}");
x++;
});
app.Run(async (context) => {
x++;
await Task.FromResult(0);
});
Answer the question
In order to leave comments, you need to log in
And how many requests flies in Chrome in the Network tab? Exactly one? I think that two. I put it on a favicon.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question