Bar*_*rka 4 c# asp.net-mvc controller asp.net-mvc-routing
我有以下控制器方法:
public ActionResult GetResults(string viewToReturn, int resultsPerPage,
string classification = null, string sessionId = null, int? lastId= null)
{
...
}
Run Code Online (Sandbox Code Playgroud)
通过以下url调用上面的方法:
http://localhost:63455/Home/GetResults?viewToReturn=grid&resultsPerPage=30
Run Code Online (Sandbox Code Playgroud)
导致此消息抛出异常:
在控制器'MyWebSite.Controllers.HomeController'上找不到公共操作方法'GetResults'.
这里是RegisterRoutes:
......
routes.MapRoute("Home", "home/{action}/{*qualifier}",
new { controller = "Home", action = "Index", qualifier = UrlParameter.Optional });
......
routes.MapRoute("SearchTitle", "{*path}",
new { controller = "Home", action = "SearchTitle", path = UrlParameter.Optional });
Run Code Online (Sandbox Code Playgroud)
为什么我会收到此错误,如何解决?谢谢!
| 归档时间: |
|
| 查看次数: |
19737 次 |
| 最近记录: |