在控制器上找不到公共操作方法
我有以下控制器方法:
public ActionResult GetResults(string viewToReturn, int resultsPerPage, string classification = null, string sessionId = null, int? lastId= null) { ... }
通过以下url调用上面的方法:
http://localhost:63455/Home/GetResults?viewToReturn=grid&resultsPerPage=30
导致此消息抛出exception:
在控制器’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 });
为什么我会收到此错误,如何解决? 谢谢!
我在方法上有[HttpPost]属性。 我可以发誓我之前删除了它,但不知怎的,在我rest一下然后回来之后,我看到了它。 删除后,现在一切正常。