Multiple actions were found that match the request
2016-06-11 21:09
585 查看
Web API错误信息:
本文出自 “lybing” 博客,请务必保留此出处http://lybing.blog.51cto.com/3286625/1788000
{"Message":"An error has occurred.","ExceptionMessage":"Multiple actions were found that match the request: \r\nSystem.Collections.Generic.IEnumerable`1[Lybing.Invoice.DataContract.Product] Get(Lybing.Invoice.Business.Model.ProductSearch) on type Lybing.Invoice.Web.ApiControllers.ProductController\r\nSystem.Collections.Generic.IEnumerable`1[Lybing.Invoice.DataContract.Product] GetAll() on type Lybing.Invoice.Web.ApiControllers.ProductController\r\nSystem.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)\r\n at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.SendAsyncInternal(HttpRequestMessage request, CancellationToken cancellationToken)\r\n 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 });恢复正常。
本文出自 “lybing” 博客,请务必保留此出处http://lybing.blog.51cto.com/3286625/1788000
相关文章推荐
- Android常用的Uiutl
- AndroidStudio创建项目时一直处于building“project name”gradle project info的解决办法
- 去除[WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platfor
- [javaSE] GUI(鼠标事件)
- 【颗粒归仓】(四)代码走查--在MSBuild上集成StyleCop的配置
- GUID
- IBM Bluemix IoT Platform 创建设备和API密钥
- perl多线程rsync备份文件到远端主机
- IOS UIDevice & IOS检测屏幕旋转实例
- 编写函数返回值value的二进制模式从左到右翻转后的值
- IOS UITableView单元点击事件
- UEditor之基于Java图片上传前后端源码研究
- UEditor之实现配置简单的图片上传示例
- hiberante 中sql查询, createSqlQuery 的具体用法
- 安卓中的UI
- 小技巧,如何在Label中显示图片
- UI Components总结
- Navigation Drawer Activity在小米MIUI中的Toolbar按扭菜单的奇怪表现及修正方法
- 自记android学习小tips:继承并更改UIL的RoundedBitmapDisplayer,实现自定义圆角图片
- 【 POJ - 3801】Crazy Circuits(有源汇、上下界最小流)