1

Topic: asp net core pipeline

How much understood from perusal ASP.NET Core Middleware , is more true than it Invoke it is caused once. , I create the empty project, I change Startup a little: public class Startup {//This method gets called by the runtime. Use this method to add services to the container.//For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices (IServiceCollection services) {} static int _count = 0;//This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure (IApplicationBuilder app, IHostingEnvironment env) {if (env. IsDevelopment ()) {app. UseDeveloperExceptionPage ();} app. Run (async (context) => {await context. Response. WriteAsync ($ "Hello World {++ _count}!");//it is caused twice});} } The question why the code from labeled is caused by a comment in me two times, it is visible if to be pushed Refresh in the browser. I.e. one  two calls. Or I that not so understood that then explain ...

2

Re: asp net core pipeline

Hello, InCodeWeTrust, you wrote:   found the answer - https://stackoverflow.com/questions/460 … le_rich_qa so more clearly (now the counter grows on +1 for : public class Startup {public void ConfigureServices (IServiceCollection services) {services. AddMvc ();} static int _count = 0; private static void HandleMapTest1 (IApplicationBuilder app) {app. Run (async context => {await context. Response. WriteAsync ("Map Test 1");});} public void Configure (IApplicationBuilder app, IHostingEnvironment env) {if (env. IsDevelopment ()) {app. UseDeveloperExceptionPage ();} app. Map ("/favicon.ico", HandleMapTest1); app. Run (async (context) => {await context. Response. WriteAsync ($ "Hello World {++ _count}!");//this code run twice per request});}}

3

Re: asp net core pipeline

Hello, Anon, you wrote: Whence confidence what is caused twice on request? The text "Hello World" is present at a body of the answer twice? Or count increases on 2? If the second possibly the browser does additional server requests. I suggest to look on  request in a debugger. About confidence it from  eyes on  in studios, and more low the answer