我有这个angularjs服务:
function checkCredentials(username,password) {
return $http.post(config.baseUrl + "api/login/", username, password)
}
这个网页api:
public class LoginController : ApiController
{
private MorenoContext _context;
public LoginController()
{
_context = new MorenoContext();
}
[HttpPost]
public async Task<IHttpActionResult> Post(string username, string password)
{
return Ok("test");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
_context.Dispose();
}
base.Dispose(disposing);
}
}
但是当在checkCredentials()客户端函数的帮助下尝试调用web api方法时,我收到此错误:
Failed to load resource: the server responded with a status of 404 (Not Found)
http://localhost/myProjectName/api/login/
知道我为什么会收到错误吗?