我已經在PersonController類下面的函數ASP.Net的Web API定製的路線不工作
[HttpGet]
[ActionName("GetBloggersNotFollowed")]
public IQueryable<object> GetBloggersNotFollowed(int companyId)
{
return Uow.People.GetPeople().Select(p => new { p.Email, p.FirstName, p.LastName, p.PhoneNumber, p.Type, p.UserName, p.Country, p.Id });
}
它是用來檢索的人的名單。
我所說的功能,從而
$.ajax({
url: "/api/person/GetBloggersNotFollowed/1"
}).success(function (people) {
PersonModule.GetPeople(people);
});
,我已經宣佈的路線在我WebApiConfig.cs
config.Routes.MapHttpRoute(
name: "ActionApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
當我嘗試調用瀏覽器我得到一個錯誤的路線
<Error>
<Message>
No HTTP resource was found that matches the request URI 'http://localhost:1045/api/person/GetBloggersNotFollowed/1'.
</Message>
<MessageDetail>
No action was found on the controller 'Person' that matches the request.
</MessageDetail>
</Error>
我不知道我在這裏我錯了。任何人都可以看到問題嗎?
你是英雄我的朋友 –
@WesleySkeen歡迎您 - 感謝您報告(p.s.請標記爲已接受,如果它回答了您的問題)。 –