[英]Swashbuckle - How do I change the displayed title of the service?
當我使用 swashbuckle 運行 .NET Core 服務時,它顯示的標題(在所有資源之上)源自程序集名稱。
如何指定我自己的標題出現在 swagger 頁面上?
(頁面上顯示的標題與文檔標題不同,可以通過傳入app.UseSwaggerUI()
方法的options.DocumentTitle
進行修改。)
編輯:這是我當前的設置代碼——它是 C# webapi
模板開箱即用的代碼:
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.MapControllers();
app.Run();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.