看板后端(旧版不需要了)
wyb
2021-05-12 43ff62c204431ab2cb35830eb57d4bc125bb9889
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System;
using System.IO;
using System.Web;
using System.Web.Http;
using System.Web.Http.Description;
using System.Web.Http.Dispatcher;
using System.Web.Routing;
using Swagger.Net;
 
//[assembly: WebActivator.PreApplicationStartMethod(typeof(MyWebApi.App_Start.SwaggerNet), "PreStart")]
//[assembly: WebActivator.PostApplicationStartMethod(typeof(MyWebApi.App_Start.SwaggerNet), "PostStart")]
namespace MyWebApi.App_Start 
{
    public static class SwaggerNet 
    {
        //public static void PreStart() 
        //{
        //    RouteTable.Routes.MapHttpRoute(
        //        name: "SwaggerApi",
        //        routeTemplate: "api/docs/{controller}",
        //        defaults: new { swagger = true }
        //    );            
        //}
        
        //public static void PostStart() 
        //{
        //    var config = GlobalConfiguration.Configuration;
 
        //    config.Filters.Add(new SwaggerActionFilter());
            
        //    try
        //    {
        //        config.Services.Replace(typeof(IDocumentationProvider),
        //            new XmlCommentDocumentationProvider(HttpContext.Current.Server.MapPath("~/bin/MyWebApi.XML")));
        //    }
        //    catch (FileNotFoundException)
        //    {
        //        throw new Exception("Please enable \"XML documentation file\" in project properties with default (bin\\MyWebApi.XML) value or edit value in App_Start\\SwaggerNet.cs");
        //    }
        //}
    }
}