Friday, May 5, 2023

What is the difference between IApplicationBuilder.Use() and IApplicationBuilder.Run()?

► We can use both the methods in Configure methods of startup class.

Both are used to add middleware delegate to the application request pipeline.

►The middleware adds using IApplication Builder. Use may call the next middleware in the pipeline whereas the middleware adds using IApplication Builder.Run method never calls the subsequent or next middleware.

► After IApplicationBuilder.Run method, system stop adding middleware in request pipeline.