SwaggerUI ASP. Net WebAPI2, swaggeruiwebapi2
ASP. NET WebAPI2 is used for background interface development. When testing with the front-end, a demo is always required to be sent to him. However, this is very troublesome and he may not be able to remember it.
Then we thought about SwaggerUI to generate a test document.
Let's take a look at its specific usage!
Step 1:
Open the package management console in VS2015 (which is your own tool) and enter:
Install-Package Swashbuckle
Wait for the installation. After the installation is complete, a configuration file SwaggerConfig. cs will appear in the App_Start folder.
Step 2:
Open the file and find c. IncludeXmlComments () in the Register () method. Add a parameter, that is, change it to c. IncludeXmlComments (GetXmlCommentsPath (thisAssembly. GetName (). Name ));
Then add a method at the same level as the Register method.
protected static string GetXmlCommentsPath(string name) { return string.Format(@"{0}\bin\{1}.XML", AppDomain.CurrentDomain.BaseDirectory, name); }
Then the configuration file ends here,
Step 3:
Continue to configure the project
Right-click Project-> properties-> Generate-> select (XML document file)-> click Save file.
Step 4:
Enter the access path
http://localhost:15416/swagger/ui/index
Replace the host and port with the sent number.
Final results
Make a note here and find that there will be comments behind each request, and there will also be comments after opening. This is the comments in your interface, which can be directly taken for display.
/// <Summary> /// send the mobile phone Verification Code /// </summary> /// <param name = "mobile"> mobile phone number </param>
Reference: http://www.cnblogs.com/fangwei0505/p/6398382.html
At the same time put SpringMVC Demo: http://blog.csdn.net/u011499992/article/details/53455144