【发布时间】:2018-08-09 08:42:08
【问题描述】:
我有这样的代码和平:
function getSopMatches(data) {
return EntityQuery.from('GetSopMatches')
.withParameters({
$method: 'POST',
$encoding: 'JSON',
$data: data
})
.using(manager).execute()
.then(success)
.catch(_queryFailed);
function success(response) {
return response.results;
}
}
它是通过这个调用的:
playerService.getSopMatches({ playerId: vm.player.id, competitionId: career.competitionId, seasonId: career.seasonId, teamId: career.teamId }).then(function (results) { //do something with it });
在我的 MVC 控制器 (BreezeController) 中,方法如下:
[HttpPost]
public IQueryable<object> GetSopMatches(SopMatch sop)
{
//this method is not called, I get a 405 Method not Allowed
}
不知何故,实际调用是 GET,而不是 POST,因此我收到 405 Method not Allowed 错误消息。
我在同一个项目(客户端 javascript/breeze 调用和服务器端 mvc 控制器方法)中还有其他可以正常工作的代码。
有谁知道我做错了什么,或者为什么将其更改为 GET 方法?
【问题讨论】:
标签: post breeze http-status-code-405