Why does the third route fail in my Web API ?
public class StudentCourseController : ApiController
{
// GET api/student
public IEnumerable<StudentCourse> Get()
{
return StudentCourseRepository.GetAll();
}
// GET api/student/5
public StudentCourse Get(int id)
{
return StudentCourseRepository.GetAll().FirstOrDefault(s => s.Id == id);
}
[Route("StudentAuto/{key}")] // Does not work
public IEnumerable<Student> StudentAuto(string key)
{
return StudentRepository.GetStudentsAuto(key);
}
When i request http://localhost:5198/api/StudentCourse/StudentAuto/mi I get a 404 error.
The detail error shows
Requested URL http://localhost:5198/api/StudentCourse/StudentAuto/mi
Physical Path C:\Users\deb\Desktop\StudentKO\KnockoutMVC\KnockoutMVC\api\StudentCourse\StudentAuto\mi
Logon Method Anonymous
Logon User Anonymous
Did i miss anything ?
thanks