我想调用的方法ProcessCriteria在AngularJS以下,但由于某种原因,我不断收到错误消息:
VM18010:1 POST (未找到)
下面是我的调用代码:
var param = { 'Item': item.Key, 'SolrLabel': SolrLabel };
$http({
method: 'POST',
url: '/api/TalentPool/ProcessCriteria',
data: param
//headers: {
// 'Content-Type': 'application/x-www-form-urlencoded'
//}
}).then(function (response) {
// success
console.log('Facet Data Posted');
return response;
},
function (response) { // optional
// failed
console.log('facet post error occured!');
});
我的服务器端方法:
[System.Web.Http.HttpPost]
public IHttpActionResult ProcessCriteria(string Item, string SolrLabel)
{
var itm = Item;
var solr = SolrLabel;
return Ok();
}
任何建议吗?
404表示您试图发布的页面不存在。您可能在网址中存在错误。 – Mistalis
你肯定API端点启动和运行 - 尝试将简单的GET方法,看看您是否可以在浏览器中点击它。 –
网址是正确的,因为我可以通过浏览器导航到它。因为你有你的行动2组的参数和路由器不明白 – ShK