1. Endpoint Registration: You define endpoints (routes) within your application, specifying: The URL pattern (e.g., /products, /api/orders/{id}). The HTTP method(s) the endpoint handles (GET, POST, etc.). The code to execute when the endpoint is matched (RequestDelegate).
2. Request Matching (Middleware): The UseRouting middleware component is added to the pipeline. When a request arrives, UseRouting analyzes the incoming URL and HTTP method. It compares the URL against your registered endpoints to find the best match.
3. Endpoint Execution (Middleware): The UseEndpoints middleware component is added to the pipeline, following UseRouting. If UseRouting found a matching endpoint, UseEndpoints executes the code (the RequestDelegate) associated with that endpoint.