ASP. NET Web API how to automatically generate a help document for annotation, asp. netapi
ASP. NET Web API generates help documents from comments
By default, ASP. NET Web APIs do not generate help documents from Controller comments. To use annotations as part of the Web API help document, for example, to display the summary in the Description column of the help document, you need to perform some configuration operations.
First, open the properties page of the Web API project in Visual Studio. On the Build settings page, select XML document file and enter the path of the XML file to be generated, for example, App_Data \ OpenAPI. XML.
Then, compile the project to generate an xml file in the corresponding path.
Next, open the Areas \ HelpPage \ App_Start \ HelpPageConfig. cs file, cancel the comments of the config. SetDocumentationProvider code, and modify the path:
Then re-compile and access the/help page to see the effect.
Copy codeThe Code is as follows:
Config. SetDocumentationProvider (new XmlDocumentationProvider (HttpContext. Current. Server. MapPath ("~ /App_Data/OpenAPI. xml ")))
I hope to help you with the above brief introduction.