是否可以使用相同的routeTemplate为不同的MapHttpRoutes设置多个处理程序? 例如:
config.Routes.MapHttpRoute(
name: "TrainerUnconfirmedCandidatesApi",
routeTemplate:
"api/unconfirmed-candidates/{guid}",
defaults: new { controller = "UnconfirmedCandidates", guid = RouteParameter.Optional },
constraints: null,
handler: trainerRouteHandler
);
config.Routes.MapHttpRoute(
name: "AdminUnconfirmedCandidatesApi",
routeTemplate:
"api/unconfirmed-candidates/{guid}",
defaults: new { controller = "UnconfirmedCandidates", guid = RouteParameter.Optional },
constraints: null,
handler: adminRouteHandlers
);
或者也许是这样:
config.Routes.MapHttpRoute(
name: "AdminUnconfirmedCandidatesApi",
routeTemplate:
"api/unconfirmed-candidates/{guid}",
defaults: new { controller = "UnconfirmedCandidates", guid = RouteParameter.Optional },
constraints: null,
handler: adminRouteHandlers, trainerRouteHandler
);
P.S。我知道这两个例子都不起作用。