As I\'m trying to understand them, It seem like they are both used to route/map the request to a certain endpoint
Based dotnet core documentation:
╔══════════════════════════════════════════╦═══════════════════════════════════════╗
║ app.UseRouting() ║ app.UseEndPoints() ║
╠══════════════════════════════════════════╬═══════════════════════════════════════╣
║ Find Endpoint ║ Execute Endpoint ║
║ ║ ║
║ Adds route matching to the middleware ║ Adds endpoint execution to the ║
║ pipeline. This middleware looks at the ║ middleware pipeline. ║
║ set of endpoints defined in the app, ║ It runs the delegate associated ║
║ and selects the best match based ║ with the selected endpoint. ║
║ on the request. ║ ║
║ ║ ║
╚══════════════════════════════════════════╩═══════════════════════════════════════╝
Based above table we should take care about some tips:
If the app calls UseStaticFiles, place UseStaticFiles before UseRouting.
it's important that you place the Authentication and Authorization middleware between UseRouting and UseEndPoints .
Any middleware that appears after the UseRouting() call will know which endpoint will run eventually.
Any middleware that appears before the UseRouting() call won't know which endpoint will run eventually.