Adding Web API and API documentation to an existing MVC project

后端 未结 7 928
时光说笑
时光说笑 2021-02-14 03:01

I have successfully added a web api controller to an existing MVC4 application.

I would like to have the api documentation functionality as is

7条回答
  •  走了就别回头了
    2021-02-14 03:54

    I can confirm the answers before - the HelpPage does pick up any controller no matter where it is located if it matches routing and inherits from ApiController.

    I spent hours hunting this one down. I figured, it must be something I added to the project that's messing up my routes/APIs. So I found it after hours of installing/deinstalling various Nuget packages. The problem with my project was that I had Glimpse.Mvc4 package installed. This package somehow prevented the ApiExplorer to pick up my APIs. This is obviously a bug within the Glimpse.Mvc4 (or Glimpse.AspNet) packages or a bug within ApiExporer (I didn't go into trouble finding out what the bug was).

    I'll report this to the Glimpse team. Posting this answer here maybe will help someone else too.

提交回复
热议问题