5
をバインドすることはできませんパラメータを渡すとき、私はここにMVCのWeb API、エラー:複数のパラメータ
"Can't bind multiple parameters"
、エラーを取得する私のコード
[HttpPost]
public IHttpActionResult GenerateToken([FromBody]string userName, [FromBody]string password)
{
//...
}
アヤックスです:
$.ajax({
cache: false,
url: 'http://localhost:14980/api/token/GenerateToken',
type: 'POST',
contentType: "application/json; charset=utf-8",
data: { userName: "userName",password:"password" },
success: function (response) {
},
error: function (jqXhr, textStatus, errorThrown) {
console.log(jqXhr.responseText);
alert(textStatus + ": " + errorThrown + ": " + jqXhr.responseText + " " + jqXhr.status);
},
complete: function (jqXhr) {
},
})
可能な複製(ペイロードを送信することを確認して、体内でそのモデルを期待するアクションを更新https://stackoverflow.com/questions/14407458/webapi-multiple-put-post-parameters) –
親愛なるPaul。 私は、この質問が私の現在の質問と異なるので、これは重複していないという言及の質問をチェックしました。ありがとうございます – Tom
Web API 1または2を使用していますか? –