Я начинаю в Angularjs У меня есть метод отправки, чтобы зарегистрировать его работы отлично и выложили метод для входа в систему retutn 404 не найден.angularjs web api post works but put 404 not found
Это мой веб-Апи контроллер, имеющий сообщение и поместить метод
// POST api/StudentsAPI
//[EnableCors(origins: "*", headers: "*", methods: "*")]
// [ActionName("register")]
// [HttpPost]
public HttpResponseMessage PostRegister(Users Student)
{
if (ModelState.IsValid)
{
Random rnd = new Random();
int card = rnd.Next(52);
Student.user_id = card;
// _usertManager.AddUser(Student);
var activateToken = WebSecurity.CreateUserAndAccount(Student.user_mail, Student.password, Student);
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, Student);
response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = Student.user_id }));
// _mailManager.Sendmail("[email protected]", "[email protected]","dd","dd");
return response;
}
else
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}
////[EnableCors(origins: "*", headers: "*", methods: "*")]
//[ActionName("Login")]
[HttpPut]
public HttpResponseMessage PutLogin(string userMaill, string passwordd)
{
if (ModelState.IsValid)
{
_usertManager.Login(userMaill, passwordd);
HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, userMaill);
response.Headers.Location = new Uri(Url.Link("DefaultApi", new { userMaill = userMaill }));
return response;
}
else
{
return Request.CreateResponse(HttpStatusCode.BadRequest);
}
}
Edit: прежде, чем эта ошибка другая ошибка появляться, которые ставят метод не позволил я это исправить, добавив этот код в файле web.config
<system.webServer>
<modules>
<remove name="WebDAVModule" />
</modules>
<handlers>
<remove name="WebDAV" />
</handlers>
<security>
<requestFiltering>
<verbs allowUnlisted="false">
<add verb="GET" allowed="true" />
<add verb="POST" allowed="true" />
<add verb="DELETE" allowed="true" />
<add verb="PUT" allowed="true" />
</verbs>
</requestFiltering>
</security>
Controller.js
$scope.login = function() {
var LoginDto = {
user_maill: $scope.user_maill,
passwordd: $scope.passwordd,
};
var promisePost = CRUD_OperService.put(LoginDto);
promisePost.then(function (pl) {
GetAllRecords();
$scope.Message = "done";
ClearModels();
}, function (err) {
console.log("Err" + err);
});
};
});
service.js
this.put = function (LoginDto) {
var request = $http({
method: "put",
url: "/api/HomeApi",
data: LoginDto
});
return request;
}
показать нам ссылку вы называете, когда вы получаете 404 - не найден статус –
я проверить в визуальная студия не опубликовала сайт – salah