What are the differences between app.UseRouting() and app.UseEndPoints()?

后端 未结 5 913
忘掉有多难
忘掉有多难 2021-01-31 14:48

As I\'m trying to understand them, It seem like they are both used to route/map the request to a certain endpoint

5条回答
  •  死守一世寂寞
    2021-01-31 15:11

    UseRouting calculates what route should be used for a request URL path, but doesn't route at this point in the pipeline. UseRouting adds metadata that can be used by subsequent middleware.

    UseEndpoints executes the Controller and corresponding handler.

    Take a look at this helpful write-up: https://andrewlock.net/converting-a-terminal-middleware-to-endpoint-routing-in-aspnetcore-3/

提交回复
热议问题