【发布时间】:2016-08-14 22:02:35
【问题描述】:
我知道我以前做过这个并且它已经成功了,但是今天当我在我的控制器中创建了两个方法并且得到了..
当前对控制器类型“HomeController”的操作“ContactUs”的请求在以下操作方法之间不明确:
System.Web.Mvc.ActionResult ContactUs() on type HomeController System.Web.Mvc.ActionResult ContactUs(ContactUs) 类型为 HomeController。
这是我的两个与 post/get 不同的地方。
<HttpGet>
Function ContactUs() As ActionResult
Dim objModel As New ContactUsModel
Return View(objModel)
End Function
<HttpPost>
Function ContactUs(ByVal Model As ContactUs) As ActionResult
Dim a As String = ""
Return View(Model)
End Function
我不明白这些怎么可能是模棱两可的,因为它们有不同的签名并且用 post/get 装饰。
【问题讨论】:
-
您在什么情况下遇到此异常?
-
如果我只是尝试转到 /home/contactus 的页面,则会收到错误消息。如果我删除第二种方法(发布),页面加载正常。
-
确保您使用的是 MVC 属性 btw,因为名称完全相同的属性存在于
System.Web.Http命名空间下。您需要的一次在System.Web.Mvc
标签: asp.net asp.net-mvc vb.net asp.net-mvc-4