Adrian P
Adrian P

Reputation: 105

How to enable ASP.NET Web API Help Page documenting in Areas

I'm using Areas to help organize my Web API. I essentially have 2 sets of APIs, one for performing account/user management and the other is using the service that I provide.

So my routing looks like this

"api/{area}/{controller}/{action}/{accountNumber}"

Before I started using Areas, the Help Page was working fine, but after I started using Areas it stopped generating the help documentation. Is there something I need to configure to get Areas to be included by the Help page?

Upvotes: 1

Views: 914

Answers (1)

Peter Hedberg
Peter Hedberg

Reputation: 3659

I've used multiple routes to solve the same thing without areas:

config.Routes.MapHttpRoute("Foo",
                           "api/Foo/{fooId}",
                           new {controller = "Foo", fooId = RouteParameter.Optional});

config.Routes.MapHttpRoute("Foo_Bar",
                           "api/Foo/{FooId}/Bars/{barId}",
                           new {controller = "Bar", barId = RouteParameter.Optional});

Works fine with the HelpPage.

I've also tried AttributeRouting, but I prefer my routes.

Upvotes: 1

Related Questions