0
routes.MapRoute(
            name: "GetAdressen",
            url: "{controller}",
            defaults: new { controller = "AdressenController", action = "GetAdressen"}
        );
        routes.MapRoute(
            name: "GetEinsaetze",
            url: "{controller}",
            defaults: new { controller = "EinsaetzeController", action = "GetEinsaetze"}
        );

在这种情况下,只有 /Adressen 有效,/Einsaetze 无效

        routes.MapRoute(
            name: "GetEinsaetze",
            url: "{controller}",
            defaults: new { controller = "EinsaetzeController", action = "GetEinsaetze"}
        );
routes.MapRoute(
            name: "GetAdressen",
            url: "{controller}",
            defaults: new { controller = "AdressenController", action = "GetAdressen"}
        );

在这种情况下,只有 /Einsaetze 有效,/Adressen 无效

为什么?

4

1 回答 1

0

像这样使用

   routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "projectName.Controllers" });
于 2012-12-06T11:04:37.537 回答