zoukankan      html  css  js  c++  java
  • swagger

    swagger:
    1.Nuget安装Swashbuckle依赖
    2.修改SwaggerConfig.cs
    GlobalConfiguration.Configuration
    .EnableSwagger(c =>
    {
    c.SingleApiVersion("v1", "ZJCD.User.Service");
    c.IncludeXmlComments(string.Format("{0}/bin/ZJCD.User.Service.xml", System.AppDomain.CurrentDomain.BaseDirectory));
    c.IncludeXmlComments(string.Format("{0}/bin/ZJCD.User.Model.xml", System.AppDomain.CurrentDomain.BaseDirectory));

    c.UseFullTypeNameInSchemaIds();
    })
    3.右键model项目,webapi接口项目生成中,输出xml文档,将modle.xml service.xml输出
    4.修改WebApiConfig.cs中Register方法路由配置:
    config.Routes.MapHttpRoute(
    name: "DefaultApi",
    routeTemplate: "{controller}/{action}/{id}",
    defaults: new { id = RouteParameter.Optional }
    );

    5.发布项目,ip:port/swagger/ui/index 浏览接口文档

  • 相关阅读:
    css问题
    前端性能优化整理
    算法之排序
    浅谈webpack优化
    js设计模式
    事件模型
    浏览器缓存
    ucGUI 12864 从打点起
    ucGUI例程收藏
    Qt 自动搜索串口号列表
  • 原文地址:https://www.cnblogs.com/liuqiyun/p/10435090.html
Copyright © 2011-2022 走看看