这是控制器:
public class RECAPTCHAController : ApiController
{
[HttpPost]
public HttpResponseMessage Post(string response)
{
bool verified = Models.ReCaptcha.Verify(HttpContext.Current.Request);
return this.Request.CreateResponse(HttpStatusCode.OK, new { verified = verified });
}
}
我正在使用Angular来调用这个控制器:
$http.post(API_ENDPOINT + '/RECAPTCHA/Post', { response: vm.recaptcha }).
success(function (data, status, headers, config) {
vm.captchaVerified = data.verified;
});
我收到以下错误:
{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:64189/api/RECAPTCHA/Post'.","MessageDetail":"No action was found on the controller 'RECAPTCHA' that matches the request."}
答案 0 :(得分:0)
试试这个
$http.post(API_ENDPOINT + '/RECAPTCHA/', vm.recaptcha).
success(function (data, status, headers, config) {
vm.captchaVerified = data.verified;
});