9

I have a preexisting MVC app that I added Web API and Web API Self Documentation using Nuget. While the Web API controllers function fine (return valid responses to HTTP requests) the Help controller is not finding any Web API methods to document.

In the Help controller Index action "Configuration.Services.GetApiExplorer().ApiDescriptions" is returning with 0 results.

I even went as far as copying the entire "HelpPage" area from another functioning web app.

What populated ApiDescriptions and are there any config settings I need to set to expose my api to documentations?


Things I have tried:

  • Reinstalling nuget packages
  • Copying over HelpPage area from working project
  • Copying over routes from working project
  • Comparing references from working project to broken project
  • Comparing Global.asax.cs from working project to broken project
  • Comparing web.config's from working project to broken project
William Edmondson
  • 3,619
  • 3
  • 32
  • 41
  • Could you share how your configured routes and a controller that is not showing up? – Kiran Jul 30 '13 at 23:16
  • It is using the default web API route. No customization. – William Edmondson Jul 30 '13 at 23:23
  • Ok. Could you share a controller(only the declarations should be enough) for which the help page isn't showing the descriptions? – Kiran Jul 30 '13 at 23:30
  • This is boilerplate as well. I added a test controller straight from the wizard as a test to be sure I had not altered anything. – William Edmondson Jul 30 '13 at 23:37
  • hmm..this sounds like a pretty basic scenario and would have expected to work...we need more details to look into the problem otherwise its just guesswork... – Kiran Jul 30 '13 at 23:54

2 Answers2

7

It turns out my Glimpse MVC 4 installation was interfering. This is a known issue with Glimpse and Web API Help Pages. Uninstalling Glimpse fixes the problem.

William Edmondson
  • 3,619
  • 3
  • 32
  • 41
  • My project does not have Glimpse reference, still it doesn't work. Any idea about it? – RKS Feb 15 '16 at 11:07
3

The link provided by William also provides the following work-around in this comment which worked for me:

For now, you can use a simple workaround by ignoring the RoutesInspector. Just add this to your web.config:

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd">
<inspectors>
      <ignoredTypes>
        <add type="Glimpse.AspNet.Inspector.RoutesInspector, Glimpse.AspNet"/>
      </ignoredTypes>
    </inspectors>
</glimpse>
profMamba
  • 988
  • 1
  • 14
  • 29