Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.Net Web API Help Page returning empty output

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
like image 966
William Edmondson Avatar asked Jul 30 '13 23:07

William Edmondson


2 Answers

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.

like image 123
William Edmondson Avatar answered Sep 22 '22 11:09

William Edmondson


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>
like image 20
profMamba Avatar answered Sep 21 '22 11:09

profMamba