2

aspnet Web APIを使用した属性ルーティングは初めてです。

public class UsersController : ApiController
{
    [GET("users/me/brands/{id}")]
    public IEnumerable<Brand> GetBrands(long id)
    {
        return _repository.FindByUser(id);
    }
}

しかし、私はこのアクションに到達できませんでした。私は非常に多くの方法を試しました:

  1. http://example.com/api/users/brands/4
  2. http://example.com/api/users/brands?id=4
  3. http://example.com/users/brands?id=4
  4. http://example.com/users/brands/4

PS:私もマッピングしました[GET("api/users/me/brands/{id}")]

私は何が欠けていますか?

4

1 に答える 1