Web API错误信息:
{"Message":"An error has occurred.","ExceptionMessage":"Multiple actions were found that match the request: rnSystem.Collections.Generic.IEnumerable`1[Lybing.Invoice.DataContract.Product] Get(Lybing.Invoice.Business.Model.ProductSearch) on type Lybing.Invoice.Web.ApiControllers.ProductControllerrnSystem.Collections.Generic.IEnumerable`1[Lybing.Invoice.DataContract.Product] GetAll() on type Lybing.Invoice.Web.ApiControllers.ProductControllerrnSystem.Collections.Generic.IEnumerable`1[Lybing.Invoice.DataContract.Product] Get() on type Lybing.Invoice.Web.ApiControllers.ProductController","ExceptionType":"System.InvalidOperationException","StackTrace":" at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)rn at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)rn at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)rn at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken)rn at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)"}
原来默认的API路由为:
routes.MapHttpRoute( name: "API Default", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional });
修改routTemplate:
routes.MapHttpRoute( name: "API Default", routeTemplate: "api/{controller}/{action}/{id}", defaults: new { id = RouteParameter.Optional });
恢复正常。
转载于:https://blog.51cto.com/lybing/1788000
最后
以上就是知性酒窝最近收集整理的关于Multiple actions were found that match the request的全部内容,更多相关Multiple内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复