我目前在我的项目中使用 swagger,并且那里有超过 100 个 Controller 。我猜由于 Controller 数量较多,swagger UI 文档页面需要超过 5 分钟才能加载其 Controller 。是否可以在 UI 页面选择特定 Controller 并仅为它们加载选项? 或者还有其他方法可以更快地加载 UI 页面吗? 帮助我!
最佳答案
您可以在任一 Controller 上使用 ApiExplorerSettings 来完全忽略 Controller ,也可以在方法上使用 ApiExplorerSettings。
[ApiExplorerSettings(IgnoreApi = true)]
public class MyController
{
[ApiExplorerSettings(IgnoreApi = true)]
public string MyMethod
{
...
}
}
关于c# - 在 swagger-swashbuckle UI 中仅显示选定的 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41757920/