【发布时间】:2019-04-15 03:14:23
【问题描述】:
【问题讨论】:
标签: .net asp.net-web-api swagger swagger-ui swagger-2.0
【问题讨论】:
标签: .net asp.net-web-api swagger swagger-ui swagger-2.0
您需要在 Startup.cs 文件中配置设置,如下所示
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info
{
Version = "v1",
Title = "some title",
Description = "Web API",
TermsOfService = "None",
Contact = new Contact()
{
Name = "some name",
Email = "someemail@xxxx.com",
Url = "<url>"
}
});
c.OperationFilter<FileUploadOperation>();
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "my api 12345");
});
}
【讨论】: