Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core RequestDelegate multiple fire

I'm exploring ASP.NET Core Web Applocation empty template. And I'm little bit confused there: if I run the application created by VS new project wizard with no changes and break point on WriteAsync method I could see that it runs two times.

app.Run(async (context) =>
        {
            await context.Response.WriteAsync("Hello World!");
        });

Does anybody know if this is normal behaviour or a kind of bug?

like image 861
Alexander Avatar asked Mar 08 '26 18:03

Alexander


1 Answers

You can use logging for diagnosing these kind of issues. You can use the Debug logger to see the log messages in the debug output window.

Add the package Microsoft.Extensions.Logging.Debug to your project.json and do the following in Startup.cs's Configure method:

loggerFactory.AddDebug()

Regarding why you are seeing 2 times, I guess one of the requests is for the fav.ico from the browser.

like image 103
Kiran Avatar answered Mar 10 '26 07:03

Kiran



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!