![](/img/trans.png)
[英]The current request for action 'Create' on controller type 'WeeklyTargetController' is ambiguous between the following action methods:
[英]Request ambiguos between the following action methods Create
我已經查看了網站上的解決方案。 我已經創建了兩種方法,一種用於[HttpPost],另一種用於[HttpGet],如圖所示,但我仍然收到該錯誤消息。 代碼如下所示。 但是當我向服務器發出發布請求時,仍然出現錯誤。
[HttpGet]
public ActionResult Create()
{
return View();
}
[HttpPost]
public String Create(Customer Customer)
{
/// logic here
return "Done";
}
在以下操作方法之間,當前對控制器類型“ ****** Controller”的“創建”操作請求模棱兩可:System.String Create(Data.Models。***)在類型Data.Controllers.UserController系統上。 Web.Mvc.ActionResult在Data.Controllers.UserController類型上創建(System.Web.Mvc.FormCollection)我正在從javascript代碼中調用該方法,如下所示,這是當我收到錯誤消息時。
$.ajax({
url: urlPath + '/Create',
type: 'post',
dataType: 'json',
data: ko.toJSON(this),
contentType: 'application/json',
success: function (result) {
window.location.href = urlPath + '/';
}
檢查您的錯誤消息。 這些方法都是可以的。 但是您還有另一個帶有FormCollection
參數的Create
方法: Create(System.Web.Mvc.FormCollection)
。 如果您不再使用該方法,也許您忘記了構建項目?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.