From the course: ASP.NET Core: Middleware

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Ordering middleware

Ordering middleware

- [Instructor] The request for that environment middleware is down here after the static files were already processed and terminated on line 33. Remember, requests in the pipeline are processed for top to bottom so because that static file request terminated on line 33, it doesn't actually proceed down and put the environment middleware information into the request on line 47. So there's a simple solution to this. Let's reorganize the pipeline so that our environment middleware is triggered before the static files. So I'm going to use the hot key of alt + up and move my middleware where I want it to be. I can use the alt + down keyword and move it down. But I'm going to place it right there on line 33 and bump static files down to 34. I'll save that. And restart my application. My application is running and now I'll request my index page again and there you go. I still don't have that paragraph at the bottom, but if I click on this I do now get my hosting environment name is…

Contents