AngularJS标头从Webapi返回500个内部服务器错误
我正在尝试从angularjs应用程序向webapi post方法传递一个自定义头。但是webapi似乎没有捕获返回null到请求的头信息 我有AngularJS标头从Webapi返回500个内部服务器错误,angularjs,rest,asp.net-web-api,Angularjs,Rest,Asp.net Web Api,我正在尝试从angularjs应用程序向webapi post方法传递一个自定义头。但是webapi似乎没有捕获返回null到请求的头信息 我有 $http.defaults.headers.common.Authorization = "xasdfYer3444"; 在app.js的run方法中 请求如下 getAuthInfo: function (username, password,demographics) { var dataObj= {username:usern
$http.defaults.headers.common.Authorization = "xasdfYer3444";
在app.js的run方法中
请求如下
getAuthInfo: function (username, password,demographics) {
var dataObj= {username:username,password:password};
var getservice = $resource(baselocation + "api/account", null);
return getservice.save(dataObj);
在web api中,我有
public IHttpActionResult index(HttpRequestMessage req,AccountParams acct)
{
_accountinfo.request = req;
return Ok(_accountinfo);
}
它返回500个内部服务器错误。有人能找出我遗漏了什么吗?谢谢。500内部服务器错误意味着api方面有问题,您必须调试api代码。请在开发人员控制台中使用postmancheck尝试您的api,在请求标头中,授权标头正在发送。使用postman,我将标头取回,但不适用于angular js代码。500内部服务器错误意味着api方面有问题,您必须调试api代码。请在开发人员控制台中使用postmancheck尝试您的api,在请求标头中,授权标头正在发送。我使用postman返回标头,但不适用于angular js代码。