小编Ram*_*sad的帖子

如何使用带有Owin的WebApi 2的swashbuckle生成文档

我使用这篇文章创建了一个WebApi项目.

事情很好.但现在我的客户想要使用Swagger查看文档.我试着做配置,但事情没有用.没有获得控制器列表及其操作.

在此输入图像描述

下面是招摇配置:

using System.Web.Http;
using WebActivatorEx;
using DC.SUMS.WebAPI1;
using Swashbuckle.Application;
using System;
using System.Linq;
using Swashbuckle.Swagger;
using Swashbuckle.Dummy.SwaggerExtensions;
[assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")]

namespace DC.SUMS.WebAPI1
{
    public class SwaggerConfig
    {
        public static void Register()
        {
            var thisAssembly = typeof(SwaggerConfig).Assembly;

            GlobalConfiguration.Configuration 
                .EnableSwagger(c =>
                {

                        // By default, the service root url is inferred from the request used to access the docs.
                        // However, there may be situations (e.g. proxy and load-balanced environments) where this does not
                        // resolve correctly. You …
Run Code Online (Sandbox Code Playgroud)

swagger owin webapi2

1
推荐指数
1
解决办法
9635
查看次数

标签 统计

owin ×1

swagger ×1

webapi2 ×1