ASP. NET Web API generates help documents from annotations

Source: Internet
Author: User

By default, the ASP. NET Web API does not generate a Help document from the controller's comments. If you want to use annotations as part of the Web API help document, such as displaying the summary in the method comments in the Description column of the Help document, you need to do some configuration.

First open the property page for the Web API project in Visual Studio, on the Build Settings page, select the XML document file, and enter the path to the XML file that will be generated, for example: App_data\openapi.xml.

The project is then compiled, and the XML file is generated under the corresponding path.

Then open the Areas\helppage\app_start\helppageconfig.cs file and cancel config. Setdocumentationprovider code comments, modify the path:

Config. Setdocumentationprovider (new Xmldocumentationprovider (HttpContext.Current.Server.MapPath (" ~/app_data/openapi.xml ")));

Then recompile and visit the/help page to see the effect.

ASP. NET Web API generates help documents from annotations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.