I have a .NET 4.5 MVC 4
project which I have added the webapi.helppage
package to it via NuGet.
Then added an ApiController
to my project of the below:
public class ValuesController : ApiController
{
// GET api/values
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/values/5
public string Get(int id)
{
return "value";
}
// POST api/values
public void Post([FromBody]string value)
{
}
// PUT api/values/5
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
public void Delete(int id)
{
}
}
to see if the help page is working, but it returns an empty apidescription
collection for the below GetApiExplorer()
call:
public ActionResult Index()
{
return View(Configuration.Services.GetApiExplorer().ApiDescriptions);
}
I can however use the example api controller by navigating to /api/values
for example.
Anyone know why the apidescription
wouldn't be found?
I made a new web api project and started adding in my installed NuGet packages one by one and it turns out
Glimpse
is what is causing these not to display.I found more information here: ASP.Net Web API Help Page returning empty output
and the most appropriate work around so far is to add the below to the
web.config
glimpse section: