MVC Webapi Auto-Generate help document (GO)

Source: Internet
Author: User

Note the point:

The 1.MVC controller must inherit from the Apicontroller, otherwise it will not be visible.

2. Simple view of XML, according to the second step to generate XML, visual sense is relatively low, but the content is all, not limited to the API

The following is the reproduced text

========================================================================================

After you create a new Web API project, you will see the API help document on the homepage with the API's navigation menu, but unfortunately, Description is not content.

What do we do?

The first step:

If you use VS2013 to create a new project (VS2012 did not try), the project will have areas/helppage such a directory, you read it wrong, the document is the goods generated.

What if you delete or do not have this directory? It doesn't matter, you just need to use NuGet to add "Microsoft.AspNet.WebApi.HelpPage" this goods, and then you find that your project automatically added areas/helppage this lump

Step Two:

Select items, right-click, properties, generate, select the following XML document file, and fill out the directory yourself, such as:

Step Three:

Locate the HelpPageConfig.cs file under the Areas/helppage/app_start directory, Register method, and add a line of code:

1 config. Setdocumentationprovider (New Xmldocumentationprovider (HttpContext.Current.Server.MapPath ("~/areas/helppage/ Webapihelp.xml ")));

Then build, start the project, click on the API to see

Then you will feel that you are awesome ...

Ps: The premise of generating API documentation is that you write comments!!!!!

From

http://blog.csdn.net/shiyaru1314/article/details/49995547

Related articles recommended

Http://www.cnblogs.com/pmars/p/3673654.html

MVC Webapi Auto-Generate help document (GO)

Related Article

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.