在ASP.NET核心中创建路由的正确语法是什么?
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
routes.MapRoute(
name: "Handoff-iOS9",
//url: ".well-known/apple-app-site-association",
template: "{controller=Home}/{action=WellKnownAppleHandoff}" );
routes.MapRoute(
name: "ApplePay",
//url: ".well-known/apple-developer-merchantid-domain-association",
template: "{controller=Home}/{action=WellKnownApplePay}");
});
答案 0 :(得分:4)
这就是诀窍
app.UseMvc(routes =>
{
routes.MapRoute(
name: "Handoff-iOS9",
template: ".well-known/apple-app-site-association",
defaults: new { controller = "Home", action = "WellKnownAppleHandoff" });
routes.MapRoute(
name: "ApplePay-MacOS",
template: ".well-known/apple-developer-merchantid-domain-association",
defaults: new { controller = "Home", action = "WellKnownApplePay" });
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});