8

I installed the package from NuGet, uncommented the line from HelpPageConfig.cs-

config.SetDocumentationProvider(new XmlDocumentationProvider(HttpContext.Current.Server.MapPath("~/App_Data/XmlDocument.xml")));

I've set the same file under Properties->Build->XML documentation file, Added a new Global.asax.cs file in which I call for registration for all the areas under Application_Start method:

protected void Application_Start(object sender, EventArgs e)
{
     AreaRegistration.RegisterAllAreas();
}

I've added some summary for some of my controllers:

public class IncidentsController : ApiController
{
     /// <summary>
     /// this is the summary
     /// </summary>
     /// <param name="incidentId">this is incidentId</param>
     /// <returns>it returns something</returns>
     [Route("{incidentId}")]
     [HttpGet]
     public object GetIncidentById(int incidentId)
     {
            return Incidents.SingleOrDefault(i => i.id == incidentId);
     }
}

when i run the webpage and go to '/help' the only thing i see is

ASP.NET Web API Help Page

Introduction

Provide a general description of your APIs here.

and an empty page after that...

I tried to debug that and in HelpController.cs in:

public ActionResult Index()
{
            ViewBag.DocumentationProvider = Configuration.Services.GetDocumentationProvider();
            return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
}

I get no ApiDescriptions.

what am I missing? I'll appreciate any help!

0

2 Answers 2

13

I was able to solve this by adding GlobalConfiguration.Configure (WebApiConfig.Register); in my Application_Start () method. Because my application uses OWIN I was registering my APIs only in Startup.Configuration (IAppBuilder app).

Sign up to request clarification or add additional context in comments.

4 Comments

THANK YOU!! This was my exact problem and your answer solved it for me!
You are a Godsend! THANK YOU!!
Awesome! worked for me too. I was also using OWIN and registering in Startup. THANKS!
if this answer is a little too cryptic please see stackoverflow.com/questions/18921215/…
0

Have you mapped you XMl Path right ?

Have you added summary to your methods ? /// /// Gets some very important data from the server. ///

This should help Have you checked WebApi Help Page Description

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.