Reference: https://www.cnblogs.com/xcsn/p/7910890.html
Step 1: nuget install swashbuckle to *. webapi Project
Step 2: In *. webapi "app_start" swaggerconfig. CS, delete unnecessary comments and only use them.
Using system. web. HTTP; using webactivatorex; using framework; using swashbuckle. application; using system. io; using system. LINQ; [Assembly: preapplicationstartmethod (typeof (swaggerconfig), "register")] namespace framework {public class swaggerconfig {public static void register () {var thisassembly = typeof (swaggerconfig ). assembly; globalconfiguration. configuration. enableswagger (C => {C. singleapiversion ("V1", "Framework"); // This framework is automatically generated based on the prefix of the project. You can just change it to your own. C. includexmlcomments (getxmlcommentspath ("application"); C. usefulltypenameinschemaids (); C. resolveconflictingactions (apidescriptions => apidescriptions. first ());}). enableswaggerui ("APIs/{* assetpath}");} Private Static string getxmlcommentspath (string subname) {return directory. getfiles (system. appdomain. currentdomain. basedirectory + "bin \\"). firstordefault (n => N. tolower (). endswith (subname. tolower () + ". XML "));}}}
Step 3 :*. select application project right-click Properties generate output, select [XML document file], and modify the path: bin \ framework. application. XML is to remove the debugging in the middle.
Step 4: Compile the solution, set the WEB Project startup Item, CTRL + F5, address bar: http: // localhost: 61814/APIs/index, and you will see the result.
Use the swagger