.NET Core:路由

(1)模板路由
  在Startup的Configure方法中配置:


app.UseMvc(routes =>
{
  routes.MapRoute(
  name: "areas",
  template: "api/{v:apiVersion}/{area:exists}/{controller=Home}/{action=Index}/{id?}"
  );
});

 

(2)特性路由:


[Route("api/[area]/[controller]/[action]")]

posted @ 2019-11-18 16:40  M守护神  阅读(267)  评论(0编辑  收藏  举报