【问题标题】:Why does Swashbuckle get in the path of every call?为什么 Swashbuckle 会妨碍每次通话?
【发布时间】:2019-09-26 04:45:19
【问题描述】:

我将Swashbuckle.AspNetCore NuGet 添加到我的项目中,它似乎运行良好。 (我得到了 Swagger 页面就好了。)

但是当我处理另一个问题时(不使用 Swagger 页面),我注意到我的调用堆栈包含 Swashbuckle。

我认为 Swashbuckle(和 Swagger)是一个文档/测试页面。因此,我担心在每次调用的路径中都会看到它(再次在我不使用招摇页面时)。

为什么 Swashbuckle 在我的调用路径中?(它需要什么才能做到这一点?)

这是我的调用堆栈,因为它很有用:

Breeze.AspNetCore.QueryFns.ExtractQueryable(ActionExecutedContext context) in C:\GitHub\breeze.server.net\AspNetCore\Breeze.AspNetCore.NetCore\QueryFns.cs
Breeze.AspNetCore.BreezeQueryFilterAttribute.OnActionExecuted(ActionExecutedContext context) in C:\GitHub\breeze.server.net\AspNetCore\Breeze.AspNetCore.NetCore\QueryFilter.cs
Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

【问题讨论】:

    标签: swashbuckle


    【解决方案1】:

    当您将app.UseSwaggerUI() 添加到Startup 类时,它会插入checks route and redirect to index URL 的swagger-ui middleware

    因此,注入应用管道的简单检查

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-17
      • 2021-09-11
      • 2010-10-03
      • 1970-01-01
      • 1970-01-01
      • 2012-03-24
      • 1970-01-01
      • 2020-06-17
      相关资源
      最近更新 更多