相关疑难解决方法(0)

ASP.NET Core - Swashbuckle没有创建swagger.json文件

我无法获得Swashbuckle.AspNetCore(1.0.0)包来生成任何输出.我读过swagger.json文件应该写成'〜/ swagger/docs/v1'.但是,我没有得到任何输出.

我从一个全新的ASP.NET Core API项目开始.我应该提到这是ASP.NET Core 2. API工作,我能够从值控制器中检索值就好了.

我的启动类具有完全如本文所述的配置(GitHub上的Swashbuckle.AspNetCore).

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    // This method gets called by the runtime. Use this method to add services to the container.
    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();

        services.AddSwaggerGen(c =>
        {
            c.SwaggerDoc("v1", new Info { Title = "My API", Version = "v1" });
        });
    }

    // This method gets called by the runtime. Use this method …
Run Code Online (Sandbox Code Playgroud)

c# swagger swashbuckle asp.net-core

38
推荐指数
13
解决办法
4万
查看次数

标签 统计

asp.net-core ×1

c# ×1

swagger ×1

swashbuckle ×1