我是靠谱客的博主 含糊魔镜,这篇文章主要介绍Multiple actions were found that match the request多个操作中发现符合要求,现在分享给大家,希望可以做个参考。

在做WEBAPI时,发现这个错,

 

解决这个问题,只要把原来的路由:

 

 public class RouteConfig

    {

        public static void RegisterRoutes(RouteCollection routes)

        {

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

           

            routes.MapRoute(

                name: "Default",

                url: "{controller}/{action}/{id}",

                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }

            );

        }

    }

 

改为

 

 

 public class RouteConfig

    {

        public static void RegisterRoutes(RouteCollection routes)

        {

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

           

routes.MapHttpRoute(

name: "API Default",

routeTemplate: "api/{controller}/{action}/{id}",

defaults: new { id = RouteParameter.Optional });

            );

        }

    }

最后

以上就是含糊魔镜最近收集整理的关于Multiple actions were found that match the request多个操作中发现符合要求的全部内容,更多相关Multiple内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(53)

评论列表共有 0 条评论

立即
投稿
返回
顶部