Can't access to action Web API -Route attribute inheritance - ASP.NET Core Controllers RRS feed

  • Question

  • have three levels of route attribute inheritance :

    ClassA : ClassB public string Concat(..) [Route(..)] ClassB : ClassC [Route(..)] ClasseC: ControllerBase

    The problem is that service "Concact" in the ClasseA never working !

    Here is my code with details:

    • UniteAdministrativeController 

    public class UniteAdministrativeController : ControleurRechercheBase<Entites.UniteAdministrative, DbContext>     
          protected readonly IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAOtest;
          public UniteAdministrativeController(IRechercheDAO<Entites.UniteAdministrative, DbContext> rechercheDAO)
     : base( rechercheDAO)
         rechercheDAOtest = rechercheDAO;
     public string Concat([FromBody] CritereRecherche critereRecherche)


       public abstract class ControleurRechercheBase<TEntite, TContexte> : ControleurObtentionBase<TEntite>
          where TEntite : class
          where TContexte : ContexteBase
          protected readonly IRechercheDAO<TEntite, TContexte> RechercheDao;
          protected ControleurRechercheBase(IRechercheDAO<TEntite, TContexte> rechercheDAO);
      public Task<IActionResult> Rechercher([FromBody] CritereRecherche critereRecherche);

    ControleurObtentionBase : 

       public abstract class ControleurObtentionBase<T> : ControleurBase where T : class
         protected ControleurObtentionBase();
      [ProducesAttribute("application/json", new[] { })]
      public Task<IActionResult> Get(string parametre);

    My problem here is i can't execute the action HTTPPOST "Concat" , and when i test it with POSTMAN:     https://localhost:44339/api/v1.0/UniteAdministrative/

    I get error 415,

    How can I fix it? Or any idea to modify it ?

    Sunday, October 18, 2020 3:49 PM

All replies

  • WebAPI has a forum in ASP.NET forums.


    Sunday, October 18, 2020 5:52 PM