0
我的三個Web API方法中的兩個工作正常;第三個不 - 它又喊又叫,Dobermanesque:「遠程服務器返回錯誤(404)未找到」爲什麼找不到這個特定的Repository方法?
這裏是控制器的方法:
[Route("api/Subdepartments/GetCount")]
public int GetCountOfSubdepartmentRecords(string serialNum)
{
return _subdepartmentsRepository.GetCount(serialNum);
}
[Route("api/Subdepartments/GetAll")]
public IEnumerable<Subdepartment> GetAllSubdepartmentRecords(string serialNum)
{
return _subdepartmentsRepository.GetAll(serialNum);
}
[Route("api/Subdepartments")]
public IEnumerable<Subdepartment> GetBatchFromID(string serialNum, int ID, int CountToFetch)
{
return _subdepartmentsRepository.GetBatch(ID, CountToFetch, serialNum);
}
這裏是庫方法:
public int GetCount(string serialNum)
{
LoadSubdepartments(serialNum);
return subdepartments.Count;
}
public IEnumerable<Subdepartment> GetAll(string serialNum)
{
LoadSubdepartments(serialNum);
return subdepartments;
}
public IEnumerable<Subdepartment> GetBatch(int ID, int CountToFetch, string serialNum)
{
LoadSubdepartments(serialNum);
return subdepartments.Where(i => i.Id >= ID).Take(CountToFetch);
}
...這是我穿過的URI:
http://localhost:28642/api/Subdepartments/GetCount?serialNum=8675309e9
http://localhost:28642/api/Subdepartments/GetAll?serialNum=8675309e9
http://localhost:28642/api/Subdepartments?serialNum=8675309e9&Int=1&CountToFetch=5
爲什麼getCount將()和GETALL ()工作,而GetBatch()不?
啊,我知道這是一些愚蠢的遺漏或不正常的dyslexism! –
適合我們最好的:) – Shiva