why in asp.net core 2.0 app.Run run twice? RRS feed

  • Question

  • I create new project empty asp.net core 2.0, and write some code. And debug, but i see app.Run run twice, but i don't understand why? somebody help me

    see this code in program.cs


    and this code in starup.cs

    startup.csi don't know how website always show  i is even ( not show old), after each hit f5, i is always even

    Hello from delegate 0

    Hello from delegate 2

    Hello from delegate 4


    Hello from delegate 16 ...

    but when i debug, i can old (1,3,5,7...) but not show in web?

    why app.Run twice?


    • Edited by bbnguyenbb Thursday, September 7, 2017 7:52 AM
    • Moved by Sabah ShariqMVP Thursday, September 7, 2017 12:38 PM Moved From Visual C#
    Thursday, September 7, 2017 7:50 AM


  • Hi khacynguyen ,

    I don't fully understand what you are trying to say.

    This is the wrong forum to ask your question, you need  to use the asp.net forums


    For more information read middleware of asp.net core

     the app.run handles all incoming request by default.   Read the middleware of .net core https://docs.microsoft.com/en-us/aspnet/core/fundamentals/middleware

    "The simplest possible ASP.NET Core app sets up a single request delegate that handles all requests. This case doesn't include an actual request pipeline. Instead, a single anonymous function is called in response to every HTTP request."

    Friendly regards


    • Edited by laurens vdb Thursday, September 7, 2017 9:26 AM
    • Marked as answer by bbnguyenbb Thursday, September 7, 2017 2:20 PM
    Thursday, September 7, 2017 9:23 AM