我是靠谱客的博主 含糊魔镜,最近开发中收集的这篇文章主要介绍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 actions were found that match the request多个操作中发现符合要求所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

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

评论列表共有 0 条评论

立即
投稿
返回
顶部