title: only one middleware instance for all requests
body: <p>It looks like asp.net core will only create one instance of Middleware and use this instance for all requests. Let's say I have the following middleware:</p>
  <pre><code>public class CustomMiddleWare {
     private RequestDelegate next;
  
     public CustomMiddleWare (RequestDelegate nextDelegate) {
        next = nextDelegate;
     }
  
     public async Task Invoke(HttpContext context) {
        await context.Response.WriteAsync(&quot;Custom Middleware \n&quot;);
        await next(context);
     }
  }
  
  // startup.cs
  public void Configure(IApplicationBuilder app, IWebHostEnvironment env) {
     app.UseMiddleware&lt;CustomMiddleWare&gt;();
     ...
  }
  </code></pre>
  <p>The reason I says only one instance of the middleware is created because if you put a debugger in CustomMiddleWare's constructor, it only break once, so it is obvious only one instance of the CustomMiddleWare is created to handle all requests.</p>
  <p>My question is, only use one instance of a middleware for all requests is very inefficient, isn't it? Image if the application is used on a server that should handle multiple requests at the same time using multithreads, how can only one instance of a middleware used to handle all requests? the servier must be very slow?</p>