我如何路由" /。众所周知/ apple-app-site-association"在ASP.net核心?

时间:2016-09-05 15:24:52

标签: asp.net asp.net-core asp.net-mvc-routing handoff

在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}");
        });

1 个答案:

答案 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?}");

        });