我在 PersonController 类中有以下功能
[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>
我不知道我错了。任何人都可以看到问题吗?