I have successfully added a web api controller
to an existing MVC4
application.
I would like to have the api documentation functionality as is
As others have already said, you must first install the NuGet package Microsoft.AspNet.WebApi.HelpPage
. This will create a new HelpPage Area in your application with the views, models and controllers required to display the documentation.
However, the HelpController that is generated contains an overloaded constructor:
public HelpController(HttpConfiguration config)
{
Configuration = config;
}
This doesn't seem to play well with Unity (or probably any kind of DI container). You get this error:
[InvalidOperationException: The type String cannot be constructed. You must configure the container to supply this value.]
Remove this overload and it should work.
Also just found another reference to this: http://www.stefan-scheller.com/2013/08/the-type-string-cannot-be-constructed-web-api-with-unity/